… | |
… | |
694 | |
694 | |
695 | =item uint32_t ecb_bswap32 (uint32_t x) |
695 | =item uint32_t ecb_bswap32 (uint32_t x) |
696 | |
696 | |
697 | =item uint64_t ecb_bswap64 (uint64_t x) |
697 | =item uint64_t ecb_bswap64 (uint64_t x) |
698 | |
698 | |
|
|
699 | =item T ecb_bswap (T x) |
|
|
700 | |
699 | These functions return the value of the 16-bit (32-bit, 64-bit) value |
701 | These functions return the value of the 16-bit (32-bit, 64-bit) value |
700 | C<x> after reversing the order of bytes (0x11223344 becomes 0x44332211 in |
702 | C<x> after reversing the order of bytes (0x11223344 becomes 0x44332211 in |
701 | C<ecb_bswap32>). |
703 | C<ecb_bswap32>). |
702 | |
704 | |
703 | The overloaded C++ C<ecb_bswap> function supports C<uint8_t>, C<uint16_t>, |
705 | The overloaded C++ C<ecb_bswap> function supports C<uint8_t>, C<uint16_t>, |
… | |
… | |
754 | =item uint_fast64_t ecb_le_u64_to_host (uint_fast64_t v) |
756 | =item uint_fast64_t ecb_le_u64_to_host (uint_fast64_t v) |
755 | |
757 | |
756 | Convert an unsigned 16, 32 or 64 bit value from big or little endian to host byte order. |
758 | Convert an unsigned 16, 32 or 64 bit value from big or little endian to host byte order. |
757 | |
759 | |
758 | The naming convention is C<ecb_>(C<be>|C<le>)C<_u>C<16|32|64>C<_to_host>, |
760 | The naming convention is C<ecb_>(C<be>|C<le>)C<_u>C<16|32|64>C<_to_host>, |
759 | where be and le stand for big endian and little endian, respectively. |
761 | where C<be> and C<le> stand for big endian and little endian, respectively. |
760 | |
762 | |
761 | =item uint_fast16_t ecb_host_to_be_u16 (uint_fast16_t v) |
763 | =item uint_fast16_t ecb_host_to_be_u16 (uint_fast16_t v) |
762 | |
764 | |
763 | =item uint_fast32_t ecb_host_to_be_u32 (uint_fast32_t v) |
765 | =item uint_fast32_t ecb_host_to_be_u32 (uint_fast32_t v) |
764 | |
766 | |
… | |
… | |
852 | |
854 | |
853 | In C++ the following additional template functions are supported: |
855 | In C++ the following additional template functions are supported: |
854 | |
856 | |
855 | =over 4 |
857 | =over 4 |
856 | |
858 | |
857 | =item T ecb_peek (const void *ptr) |
859 | =item T ecb_peek<T> (const void *ptr) |
858 | |
860 | |
859 | =item T ecb_peek_be (const void *ptr) |
861 | =item T ecb_peek_be<T> (const void *ptr) |
860 | |
862 | |
861 | =item T ecb_peek_le (const void *ptr) |
863 | =item T ecb_peek_le<T> (const void *ptr) |
862 | |
864 | |
863 | =item T ecb_peek_u (const void *ptr) |
865 | =item T ecb_peek_u<T> (const void *ptr) |
864 | |
866 | |
865 | =item T ecb_peek_be_u (const void *ptr) |
867 | =item T ecb_peek_be_u<T> (const void *ptr) |
866 | |
868 | |
867 | =item T ecb_peek_le_u (const void *ptr) |
869 | =item T ecb_peek_le_u<T> (const void *ptr) |
868 | |
870 | |
869 | Similarly to their C counterparts, these functions load an unsigned 8, 16, |
871 | Similarly to their C counterparts, these functions load an unsigned 8, 16, |
870 | 32 or 64 bit value from memory, with optional conversion from big/little |
872 | 32 or 64 bit value from memory, with optional conversion from big/little |
871 | endian. |
873 | endian. |
872 | |
874 | |
873 | Since the type cannot be deduced, it has top be specified explicitly, e.g. |
875 | Since the type cannot be deduced, it has to be specified explicitly, e.g. |
874 | |
876 | |
875 | uint_fast16_t v = ecb_peek<uint16_t> (ptr); |
877 | uint_fast16_t v = ecb_peek<uint16_t> (ptr); |
876 | |
878 | |
877 | C<T> must be one of C<uint8_t>, C<uint16_t>, C<uint32_t> or C<uint64_t>. |
879 | C<T> must be one of C<uint8_t>, C<uint16_t>, C<uint32_t> or C<uint64_t>. |
878 | |
880 | |