Skip to content

Commit d58ce5a

Browse files
miladfarcaV8 LUCI CQ
authored andcommitted
Fix builds with no __builtin_bswap64 support
Currently getting `'kBitsPerByte' was not declared in this scope`. Change-Id: Ied391ac9e859f0f3548d88fd1cc57f490d99e39a Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7310534 Reviewed-by: Clemens Backes <[email protected]> Commit-Queue: Milad Farazmand <[email protected]> Cr-Commit-Position: refs/heads/main@{#104481}
1 parent 66899a1 commit d58ce5a

1 file changed

Lines changed: 7 additions & 9 deletions

File tree

src/base/bits.h

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -504,15 +504,13 @@ inline constexpr uint64_t ByteReverse64(uint64_t value) {
504504
#if V8_HAS_BUILTIN_BSWAP64
505505
return __builtin_bswap64(value);
506506
#else
507-
size_t bits_of_v = sizeof(value) * kBitsPerByte;
508-
return value << (bits_of_v - 8) |
509-
((value << (bits_of_v - 24)) & 0x00FF000000000000) |
510-
((value << (bits_of_v - 40)) & 0x0000FF0000000000) |
511-
((value << (bits_of_v - 56)) & 0x000000FF00000000) |
512-
((value >> (bits_of_v - 56)) & 0x00000000FF000000) |
513-
((value >> (bits_of_v - 40)) & 0x0000000000FF0000) |
514-
((value >> (bits_of_v - 24)) & 0x000000000000FF00) |
515-
((value >> (bits_of_v - 8)) & 0x00000000000000FF);
507+
return value << 56 | ((value << 40) & 0x00FF000000000000) |
508+
((value << 24) & 0x0000FF0000000000) |
509+
((value << 8) & 0x000000FF00000000) |
510+
((value >> 8) & 0x00000000FF000000) |
511+
((value >> 24) & 0x0000000000FF0000) |
512+
((value >> 40) & 0x000000000000FF00) |
513+
((value >> 56) & 0x00000000000000FF);
516514
#endif
517515
}
518516

0 commit comments

Comments
 (0)