@@ -765,51 +765,21 @@ bool StringToIndex(Stream* stream, index_t* index);
765765// return an address significantly above the actual current stack position.
766766V8_EXPORT_PRIVATE V8_NOINLINE uintptr_t GetCurrentStackPosition ();
767767
768- static inline uint16_t ByteReverse16 (uint16_t value) {
769- #if V8_HAS_BUILTIN_BSWAP16
770- return __builtin_bswap16 (value);
771- #else
772- return value << 8 | (value >> 8 & 0x00FF );
773- #endif
774- }
775-
776- static inline uint32_t ByteReverse32 (uint32_t value) {
777- #if V8_HAS_BUILTIN_BSWAP32
778- return __builtin_bswap32 (value);
779- #else
780- return value << 24 | ((value << 8 ) & 0x00FF0000 ) |
781- ((value >> 8 ) & 0x0000FF00 ) | ((value >> 24 ) & 0x00000FF );
782- #endif
783- }
784-
785- static inline uint64_t ByteReverse64 (uint64_t value) {
786- #if V8_HAS_BUILTIN_BSWAP64
787- return __builtin_bswap64 (value);
788- #else
789- size_t bits_of_v = sizeof (value) * kBitsPerByte ;
790- return value << (bits_of_v - 8 ) |
791- ((value << (bits_of_v - 24 )) & 0x00FF000000000000 ) |
792- ((value << (bits_of_v - 40 )) & 0x0000FF0000000000 ) |
793- ((value << (bits_of_v - 56 )) & 0x000000FF00000000 ) |
794- ((value >> (bits_of_v - 56 )) & 0x00000000FF000000 ) |
795- ((value >> (bits_of_v - 40 )) & 0x0000000000FF0000 ) |
796- ((value >> (bits_of_v - 24 )) & 0x000000000000FF00 ) |
797- ((value >> (bits_of_v - 8 )) & 0x00000000000000FF );
798- #endif
799- }
800-
801768template <typename V>
802769static inline V ByteReverse (V value) {
803770 size_t size_of_v = sizeof (value);
804771 switch (size_of_v) {
805772 case 1 :
806773 return value;
807774 case 2 :
808- return static_cast <V>(ByteReverse16 (static_cast <uint16_t >(value)));
775+ return static_cast <V>(
776+ base::bits::ByteReverse16 (static_cast <uint16_t >(value)));
809777 case 4 :
810- return static_cast <V>(ByteReverse32 (static_cast <uint32_t >(value)));
778+ return static_cast <V>(
779+ base::bits::ByteReverse32 (static_cast <uint32_t >(value)));
811780 case 8 :
812- return static_cast <V>(ByteReverse64 (static_cast <uint64_t >(value)));
781+ return static_cast <V>(
782+ base::bits::ByteReverse64 (static_cast <uint64_t >(value)));
813783 default :
814784 UNREACHABLE ();
815785 }
0 commit comments