chenBright commented on code in PR #3754:
URL: https://github.com/apache/brpc/pull/3754#discussion_r4715672988


##########
src/butil/crc32c.cc:
##########
@@ -290,12 +330,20 @@ static const uint32_t table3_[256] = {
 // Lower-level versions of Get... that read directly from a character buffer
 // without any bounds checking.
 
+#if defined(BUTIL_ARM64_CRC32_ENABLED)
+static inline uint16_t DecodeFixed16(const char* ptr) {
+  uint16_t result;
+  memcpy(&result, ptr, sizeof(result));
+  return result;
+}
+#endif
+
 static inline uint32_t DecodeFixed32(const char* ptr) {
-#if defined(ARCH_CPU_LITTLE_ENDIAN) && ARCH_CPU_LITTLE_ENDIAN
-    // Load the raw bytes
-    uint32_t result;
-    memcpy(&result, ptr, sizeof(result));  // gcc optimizes this to a plain 
load
-    return result;
+#if BUTIL_CRC32C_LITTLE_ENDIAN
+  // Load the raw bytes
+  uint32_t result;
+  memcpy(&result, ptr, sizeof(result));  // gcc optimizes this to a plain load
+  return result;
 #else
     return ((static_cast<uint32_t>(static_cast<unsigned char>(ptr[0])))

Review Comment:
   This also changes the output of the existing software path on big-endian 
ARM64. For the same 16-byte-aligned sequence `0a 06 00 00 00 00 00 00`, the 
baseline reads the first word as `0x0a060000`, while the current version reads 
it as `0x0000060a`. The new result conforms to CRC32C, but during a rolling 
upgrade both versions still use the same `CHECKSUM_TYPE_CRC32C`, so complete 
messages will be rejected because their checksums differ. Please deliver this 
format correction separately from the little-endian acceleration, or clearly 
specify a coordinated upgrade plan for big-endian nodes and add 
interoperability tests between the old and new versions.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to