… | |
… | |
448 | |
448 | |
449 | ecb_function_ ecb_const int ecb_ctz64 (uint64_t x); |
449 | ecb_function_ ecb_const int ecb_ctz64 (uint64_t x); |
450 | ecb_function_ ecb_const int |
450 | ecb_function_ ecb_const int |
451 | ecb_ctz64 (uint64_t x) |
451 | ecb_ctz64 (uint64_t x) |
452 | { |
452 | { |
453 | int shift = x & 0xffffffffU ? 0 : 32; |
453 | int shift = x & 0xffffffff ? 0 : 32; |
454 | return ecb_ctz32 (x >> shift) + shift; |
454 | return ecb_ctz32 (x >> shift) + shift; |
455 | } |
455 | } |
456 | |
456 | |
457 | ecb_function_ ecb_const int ecb_popcount32 (uint32_t x); |
457 | ecb_function_ ecb_const int ecb_popcount32 (uint32_t x); |
458 | ecb_function_ ecb_const int |
458 | ecb_function_ ecb_const int |
… | |
… | |
724 | |
724 | |
725 | /* handle large numbers and infinity */ |
725 | /* handle large numbers and infinity */ |
726 | if (ecb_expect_true (0x477fefff < x && x <= 0x7f800000)) |
726 | if (ecb_expect_true (0x477fefff < x && x <= 0x7f800000)) |
727 | return s | 0x7c00; |
727 | return s | 0x7c00; |
728 | |
728 | |
729 | /* handle zero and subnormals */ |
729 | /* handle zero, subnormals and small numbers */ |
730 | if (ecb_expect_true (x < 0x38800000)) |
730 | if (ecb_expect_true (x < 0x38800000)) |
731 | { |
731 | { |
732 | /* zero */ |
732 | /* zero */ |
733 | if (ecb_expect_true (!x)) |
733 | if (ecb_expect_true (!x)) |
734 | return s; |
734 | return s; |
735 | |
735 | |
736 | /* handle subnormals */ |
736 | /* handle subnormals */ |
|
|
737 | |
|
|
738 | /* too small, will be zero */ |
|
|
739 | if (e < (14 - 24)) /* might not be sharp, but is good enough */ |
|
|
740 | return s; |
737 | |
741 | |
738 | m |= 0x00800000; /* make implicit bit explicit */ |
742 | m |= 0x00800000; /* make implicit bit explicit */ |
739 | |
743 | |
740 | /* very tricky - we need to round to the nearest e (+10) bit value */ |
744 | /* very tricky - we need to round to the nearest e (+10) bit value */ |
741 | { |
745 | { |