mirror of
https://github.com/abseil/abseil-cpp.git
synced 2026-06-04 12:07:05 +08:00
Relax static_assert on HashtableInlineDataImpl size.
The previous equality check was too strict and fail on platforms where struct with two uint64_t bitfields has size 12, but alignment 8. PiperOrigin-RevId: 907717466 Change-Id: I7a54ac029967284d4a74aa20d946cd408e2a1254
This commit is contained in:
committed by
Copybara-Service
parent
8ce456967c
commit
bbed3b16f0
@@ -739,9 +739,10 @@ class HashtableInlineDataImpl {
|
||||
static_assert(
|
||||
sizeof(HashtableInlineDataImpl<kCapacityByValue>::HashtableCapacity) ==
|
||||
sizeof(size_t));
|
||||
static_assert(sizeof(HashtableInlineDataImpl<kCapacityByValue>) ==
|
||||
// NOTE: some platforms have uint64_t alignment equal to 4.
|
||||
sizeof(std::pair<size_t, uint64_t>));
|
||||
// NOTE: some platforms have this size to be equal to 12 for two reasons:
|
||||
// 1) uint64_t alignment equal to 4.
|
||||
// 2) struct with two uint64_t bitfields has size 12, but alignment 8.
|
||||
static_assert(sizeof(HashtableInlineDataImpl<kCapacityByValue>) <= 16);
|
||||
static_assert(
|
||||
sizeof(HashtableInlineDataImpl<kCapacityByLog>::HashtableCapacity) == 1);
|
||||
static_assert(sizeof(HashtableInlineDataImpl<kCapacityByLog>) == 8);
|
||||
|
||||
Reference in New Issue
Block a user