… | |
… | |
748 | |
748 | |
749 | Overloaded C++ rotl/rotr functions. |
749 | Overloaded C++ rotl/rotr functions. |
750 | |
750 | |
751 | C<T> must be one of C<uint8_t>, C<uint16_t>, C<uint32_t> or C<uint64_t>. |
751 | C<T> must be one of C<uint8_t>, C<uint16_t>, C<uint32_t> or C<uint64_t>. |
752 | |
752 | |
|
|
753 | =item uint_fast8_t ecb_gray8_encode (uint_fast8_t b) |
|
|
754 | |
|
|
755 | =item uint_fast16_t ecb_gray16_encode (uint_fast16_t b) |
|
|
756 | |
|
|
757 | =item uint_fast32_t ecb_gray32_encode (uint_fast32_t b) |
|
|
758 | |
|
|
759 | =item uint_fast64_t ecb_gray64_encode (uint_fast64_t b) |
|
|
760 | |
|
|
761 | Encode an unsigned into its corresponding (reflective) gray code - the |
|
|
762 | kind of gray code meant when just talking about "gray code". These |
|
|
763 | functions are very fast and all have identical implementation, so there is |
|
|
764 | no need to use a smaller type, as long as your cpu can handle it natively. |
|
|
765 | |
|
|
766 | =item T ecb_gray_encode (T b) [C++] |
|
|
767 | |
|
|
768 | Overloaded C++ version of the above, for C<uint{8,16,32,64}_t>. |
|
|
769 | |
|
|
770 | =item uint_fast8_t ecb_gray8_decode (uint_fast8_t b) |
|
|
771 | |
|
|
772 | =item uint_fast16_t ecb_gray16_decode (uint_fast16_t b) |
|
|
773 | |
|
|
774 | =item uint_fast32_t ecb_gray32_decode (uint_fast32_t b) |
|
|
775 | |
|
|
776 | =item uint_fast64_t ecb_gray64_decode (uint_fast64_t b) |
|
|
777 | |
|
|
778 | Decode a gray code bakc into linear index form (the reverse of |
|
|
779 | C<ecb_gray*_encode>. Unlike the enode functions, the decode functions |
|
|
780 | have higher time complexity for larger types, so it cna pay off to use a |
|
|
781 | smaller type here. |
|
|
782 | |
|
|
783 | =item T ecb_gray_decode (T b) [C++] |
|
|
784 | |
|
|
785 | Overloaded C++ version of the above, for C<uint{8,16,32,64}_t>. |
|
|
786 | |
753 | =back |
787 | =back |
754 | |
788 | |
755 | =head2 BIT MIXING, HASHING |
789 | =head2 BIT MIXING, HASHING |
756 | |
790 | |
757 | Sometimes you have an integer and want to distribute its bits well, for |
791 | Sometimes you have an integer and want to distribute its bits well, for |