Open
Conversation
thecppzoo
reviewed
Jun 5, 2024
|
|
||
| #include "zoo/meta/BitmaskMaker.h" | ||
| #include "zoo/swar/SWAR.h" | ||
| #include <cstdint> |
thecppzoo
reviewed
Jun 5, 2024
Comment on lines
+265
to
+266
| B val = msb.value() >> (NB - 1); | ||
| auto msbCopiedToLSB = S{val}; |
thecppzoo
reviewed
Jun 5, 2024
Comment on lines
+430
to
+431
| T res = msbCleared.value() << 1; | ||
| return S{res}; |
Owner
There was a problem hiding this comment.
Why so many unnecessary changes?
Collaborator
Author
There was a problem hiding this comment.
was getting seemingly random type errors.
Collaborator
Author
There was a problem hiding this comment.
will try and resolve
thecppzoo
reviewed
Jun 5, 2024
inc/zoo/swar/associative_iteration.h
Outdated
Comment on lines
498
to
499
| /** Transforms a number into a number into a binary tally. | ||
| * E.g. 0b0011 (3) -> 0b0111 |
Owner
There was a problem hiding this comment.
You seem to mean this converts a binary to an unary
Collaborator
Author
There was a problem hiding this comment.
yes lol thank you.
thecppzoo
reviewed
Jun 5, 2024
inc/zoo/swar/associative_iteration.h
Outdated
Comment on lines
509
to
513
| static_assert(base2TallyTransform_Plural(S{0b0001'0010'0011'0011}).value() == 0b0001'0011'0111'0111); | ||
| static_assert(base2TallyTransform_Plural(S{0b0000'0001'0010'0011}).value() == 0b0000'0001'0011'0111); | ||
| static_assert(base2TallyTransform_Plural(S{0b0100'0001'0010'0011}).value() == 0b1111'0001'0011'0111); | ||
| static_assert(base2TallyTransform_Plural(S{0b0000'0000'0000'0001}).value() == 0b0000'0000'0000'0001); | ||
| static_assert(base2TallyTransform_Plural(SWAR<8, uint16_t>{0b000000111'00000101}).value() == 0b01111111'00011111); // 7 -> 5 |
Owner
There was a problem hiding this comment.
Use whitespace to make the point of the comparison/test evident!
You not only trample the whitespace of others, but fail to use it
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Now is correct. Godbolt for your amusement. https://godbolt.org/z/T51GPhT8M
Generate the smallest mask required to blit out the overflow using (2^shift_size - 1) which basially transforms shift size into a tally representation of itself in binary. Such that 2 -> 11; 3 -> 111; 4 -> 1111; etc. This then only requires the lane index mask and a shift, then or'ing it all back into the result.