Skip to content

Commit

Permalink
Merge pull request #664 from argilo/fix-reverse-ub
Browse files Browse the repository at this point in the history
Fix undefined behaviour in volk_32u_reverse_32u
  • Loading branch information
jdemel authored Oct 22, 2023
2 parents 782b319 + 6c07635 commit fda1a8b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions kernels/volk/volk_32u_reverse_32u.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ volk_32u_reverse_32u_lut(uint32_t* out, const uint32_t* in, unsigned int num_poi
uint32_t* out_ptr = out;
unsigned int number = 0;
for (; number < num_points; ++number) {
*out_ptr = (BitReverseTable256[*in_ptr & 0xff] << 24) |
*out_ptr = ((uint32_t)BitReverseTable256[*in_ptr & 0xff] << 24) |
(BitReverseTable256[(*in_ptr >> 8) & 0xff] << 16) |
(BitReverseTable256[(*in_ptr >> 16) & 0xff] << 8) |
(BitReverseTable256[(*in_ptr >> 24) & 0xff]);
Expand Down Expand Up @@ -354,7 +354,7 @@ volk_32u_reverse_32u_neonv8(uint32_t* out, const uint32_t* in, unsigned int num_
}
number = quarterPoints * 4;
for (; number < num_points; ++number) {
*out_ptr = (BitReverseTable256[*in_ptr & 0xff] << 24) |
*out_ptr = ((uint32_t)BitReverseTable256[*in_ptr & 0xff] << 24) |
(BitReverseTable256[(*in_ptr >> 8) & 0xff] << 16) |
(BitReverseTable256[(*in_ptr >> 16) & 0xff] << 8) |
(BitReverseTable256[(*in_ptr >> 24) & 0xff]);
Expand Down

0 comments on commit fda1a8b

Please sign in to comment.