Skip to content

Commit

Permalink
Fix brotli ror build for arm
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 673862553
Change-Id: I4698cc07ae3a03582ea3a7abdf16fdaa0551937e
  • Loading branch information
laramiel authored and copybara-github committed Sep 12, 2024
1 parent 62e6dd9 commit b2860c1
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
34 changes: 34 additions & 0 deletions third_party/com_google_brotli/patches/fix_ror.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
diff -Nur a/c/common/platform.h b/c/common/platform.h
--- a/c/common/platform.h 2024-07-15 11:27:36
+++ b/c/common/platform.h 2024-09-11 21:48:42
@@ -496,20 +496,21 @@

/* Circular logical rotates. */
static BROTLI_INLINE uint16_t BrotliRotateRight16(uint16_t const value,
- size_t count) {
- count &= 0x0F; /* for fickle pattern recognition */
- return (value >> count) | (uint16_t)(value << ((0U - count) & 0x0F));
+ size_t count) {
+ return (uint16_t)(value >> (count & 15)) |
+ (uint16_t)(value << ((0u - count) & 15));
}
static BROTLI_INLINE uint32_t BrotliRotateRight32(uint32_t const value,
- size_t count) {
- count &= 0x1F; /* for fickle pattern recognition */
- return (value >> count) | (uint32_t)(value << ((0U - count) & 0x1F));
+ size_t count) {
+ return (uint32_t)(value >> (count & 31)) |
+ (uint32_t)(value << ((0u - count) & 31));
}
static BROTLI_INLINE uint64_t BrotliRotateRight64(uint64_t const value,
- size_t count) {
- count &= 0x3F; /* for fickle pattern recognition */
- return (value >> count) | (uint64_t)(value << ((0U - count) & 0x3F));
+ size_t count) {
+ return (uint64_t)(value >> (count & 63)) |
+ (uint64_t)(value << ((0u - count) & 63));
}
+

BROTLI_UNUSED_FUNCTION void BrotliSuppressUnusedFunctions(void) {
BROTLI_UNUSED(&BrotliSuppressUnusedFunctions);
4 changes: 4 additions & 0 deletions third_party/com_google_brotli/workspace.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ def repo():
],
sha256 = "6c72b4d43cd11c8cfd966dbe293cd7f11a3e4e2e08408861b49198dc50b447c3",
strip_prefix = "brotli-39bcecf4559f9b0e75c6248a75d9c0db6b123d88",
patches = [
Label("//third_party:com_google_brotli/patches/fix_ror.diff"),
],
patch_args = ["-p1"],
system_build_file = Label("//third_party:com_google_brotli/system.BUILD.bazel"),
cmake_name = "Brotli",
bazel_to_cmake = {},
Expand Down

0 comments on commit b2860c1

Please sign in to comment.