From 4515006071881dd0e918aa42e4d25896492d4a56 Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Mon, 15 Apr 2024 14:47:41 -0700 Subject: [PATCH] Make LazyField correct on 32 bit platforms. PiperOrigin-RevId: 625090378 --- src/google/protobuf/port.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/google/protobuf/port.h b/src/google/protobuf/port.h index 2b959d33df..4fec7dc138 100644 --- a/src/google/protobuf/port.h +++ b/src/google/protobuf/port.h @@ -249,6 +249,10 @@ inline constexpr bool DebugHardenClearOneofMessageOnArena() { #endif } +// Returns true if pointers are 8B aligned, leaving least significant 3 bits +// available. +inline constexpr bool PtrIsAtLeast8BAligned() { return alignof(void*) >= 8; } + // Prefetch 5 64-byte cache line starting from 7 cache-lines ahead. // Constants are somewhat arbitrary and pretty aggressive, but were // chosen to give a better benchmark results. E.g. this is ~20%