Repository navigation
Fix linux CI and AVX512-128/256 #1412
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
67292e0
c617425
a9d313a
9905ad5
fa9cd57
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1726,12 +1726,12 @@ namespace xsimd | |
| { return ssub(batch<T, sse4_2>(s), batch<T, sse4_2>(o)); }, | ||
| self, other); | ||
| } | ||
| else if (std::is_signed_v<T>) | ||
| else if constexpr (std::is_signed_v<T>) | ||
| { | ||
| auto mask = (other >> (8 * sizeof(T) - 1)); | ||
| auto other_is_negative = other < batch<T, A>(T(0)); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is much more idiomatic |
||
| auto self_overflow_branch = min(std::numeric_limits<T>::max() + other, self); | ||
| auto self_underflow_branch = max(std::numeric_limits<T>::min() + other, self); | ||
| return select(batch_bool<T, A>(mask.data), self_overflow_branch, self_underflow_branch) - other; | ||
| return select(other_is_negative, self_overflow_branch, self_underflow_branch) - other; | ||
| } | ||
| else | ||
| { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1561,7 +1561,7 @@ namespace xsimd | |
|
|
||
| const uint32_t magic = (0x80 + 0x4000 + 0x200000 + 0x10000000); | ||
|
|
||
| unsigned char res = ((data * magic) >> 24) & 0xFF; | ||
| unsigned char res = (data * magic) >> 28; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I feel ashamed. But also very proud of that trick ;-)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tend to write all magic numbers as result of |
||
| return res; | ||
| } | ||
| else if constexpr (N == 2) | ||
|
|
@@ -1571,7 +1571,7 @@ namespace xsimd | |
|
|
||
| const uint16_t magic = (0x80 + 0x4000); | ||
|
|
||
| unsigned char res = ((data * magic) >> 8) & 0xFF; | ||
| unsigned char res = (data * magic) >> 14; | ||
| return res; | ||
| } | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's so error prone, thanks for fixing this.