This makes the logic clearer and also allows reuse in other macros in the future, such as hardened assertions.
PiperOrigin-RevId: 908751829
Change-Id: Ic6f2e77755718db1df86510145e16e2ba6c83bcb
absl::HighPrecision produces a string with enough precision that it
can be parsed back to the original floating-point value.
PiperOrigin-RevId: 908689724
Change-Id: Ib076de9e32b0168ce587ea676088f05c8abe7e95
These versions accept a container as the output destination. The primary motivation for these overloads is to add bounds checking. We determine if an object is a container by checking if they support `std::begin`/`std::end`.
PiperOrigin-RevId: 907840607
Change-Id: I10430108dc734f1e93c0cef6ca33d251520ac3e8
These versions accept a container as the output destination. The primary motivation for these overloads is to add bounds checking. We determine if an object is a container by checking if they support `std::begin`/`std::end`.
PiperOrigin-RevId: 907806544
Change-Id: I8830b18df5acad0cd745c7a8d0dd8d1065265c28
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 change introduces templates for HashtableCapacity, PerTableSeed, and HashtableInlineData to allow for storing capacity as either a full size_t or as a log2 value in a single byte.
`kCapacityAsOneByte` is not possible to propagate to raw_hash_set. The classes are only used in tests.
In kCapacityAsOneByte mode, seed is reduced to 8 bits.
NextHashTableSeed always return 16 bit for simplicity.
PiperOrigin-RevId: 907151369
Change-Id: Iec812b3d564adb3c96d99f11754e116f38848829
`std::monostate` is a struct without any fields thus there is no content to be printed at all. However, the default printer prints it as `"unprintable value of size 1 @{some address}"` which is not very useful unless we're really interested in the address of struct having nothing.
PiperOrigin-RevId: 906966193
Change-Id: I7121bd9d58ac9930fa19432d76788d1df6dc5b78
This will let us deprecate the declarations without triggering warnings in Abseil itself.
PiperOrigin-RevId: 906360966
Change-Id: Iee362ac0eac647909ef38003280f1179813f764d
This associates debug information with the assertion sites, allowing clearer stack-traces for assertion failures and better accounting of the performance overhead of assertions.
This change also changes the assertion functions from inline to constexpr, to allow functions using them to be called from static assertions (like optional_ref::operator* in optional_ref's constexpr test).
PiperOrigin-RevId: 903344377
Change-Id: I50166b6cf12a8f139ed3c9fe4f6c6e0f24b51812
This associates debug information with the assertion sites, allowing clearer stack-traces for assertion failures and better accounting of the performance overhead of assertions.
This change also changes the assertion functions from inline to constexpr, to allow functions using them to be called from static assertions (like optional_ref::operator* in optional_ref's constexpr test).
PiperOrigin-RevId: 903309187
Change-Id: Icbe0fd9d0fe9e212036d17468e80833b95b8a82d
This method is in the transitive callgraph of TCMalloc via absl::base_internal::CycleClock::Frequency(). ABSL_RAW_LOG avoids a potential reentrancy/deadlock issue when TCMalloc invokes `Frequency` while holding one of its locks.
PiperOrigin-RevId: 903293020
Change-Id: I4c8310fa32c1e12d049296377c5a9bf069ef513b
This change wraps the capacity_ member of CommonFields in a new HashtableCapacity class. This class encapsulates the logic for handling valid capacities and debug-only sentinel values like kMovedFrom and kDestroyed, improving type safety and clarity. Capacity-related helper functions are also reordered within the file to be defined before CommonFields.
The `capacity_` member is now part of the `HashtableInlineData` class, which was previously named `HashtableSize`. This change groups stack-allocated data members together.
This is necessary to make an experiment of storing capacity as 1 byte.
Having Capacity in the same struct would allow to use `data_` as bit-field.
PiperOrigin-RevId: 903283983
Change-Id: Ia5c05f6a476f5b32967737fcb626565948c1505d
be exported. The one function that is currently using it is easily
implemented with absl::Base64Escape().
PiperOrigin-RevId: 900830658
Change-Id: I859d67efafd5ba96921bb75c9207438975d055d6
Most current uses of ABSL_HARDENING_ASSERT are one of:
* numerical comparison
* checking that a container is non-empty
* checking that a pointer is non-null.
This change adds additional hardening assert functions which conduct the
comparisons necessary for these checks inside the body of the assertion
function, so that the cost of performing the check can be attributed
to the assertion.
For the smaller set of cases where more complex conditions are checked,
a general HardeningAssert which takes a bool is provided.
PiperOrigin-RevId: 899780652
Change-Id: I00602302a5d42d483053ad66d8c3e796d1708567
Most usages of absl::void_t compile fine with std::void_t, so we migrate them here. A few don't compile due to overly eager template instantiations, so we leave those.
PiperOrigin-RevId: 897231619
Change-Id: Iad34101916dac2b995257ebd5d6aacb9a0acfa32
to provide a centralized policy for hardware-accelerated
implementations in headers.
This option addresses ODR violations that occur when Abseil headers
use compile-time feature detection (such as __SSE4_2__) in inline
functions. If translation units are compiled with inconsistent CPU
architecture flags (e.g., -march=native vs -march=generic) and linked
together, they may disagree on the implementation of these inline
functions. This can lead to crashes or silent data corruption in
hashing.
The new option provides three levels of control:
- 0: Portable. Forces software-only implementations in headers,
guaranteeing ABI safety across mixed translation units.
- 1: Required. Forces hardware-accelerated implementations in
headers. The build will fail if the required instructions are not
enabled in the compiler environment.
- 2: Auto-detect. Selects the best available implementation based on
compiler flags, but can't guarantee safety if translation units are
compiled with inconsistent flags.
PiperOrigin-RevId: 896569507
Change-Id: Ifcbc1f3980883feeaa4f05f845ce32310ca7d533
This allows the compiler to optimize conversions to StatusOr since it can
assume the Status is !ok instead of having to check again.
PiperOrigin-RevId: 896110150
Change-Id: I0dc167906b761339aaac5934764fe2bd6deb1624
This won't replace all call sites, but that's fine. We only want to replace the call sites that compile fine, since they don't need to use absl::void_t.
PiperOrigin-RevId: 896017307
Change-Id: I7e78066dc973e135922b11fba5c7642563ef6a67
This will let us deprecate the declarations without triggering warnings in Abseil itself.
PiperOrigin-RevId: 895480358
Change-Id: I2e15877c15ed83f48ddb68cc73344c14b533bc68
This will let us deprecate the declarations without triggering warnings in Abseil itself.
PiperOrigin-RevId: 894202105
Change-Id: I57bb2a1647be1fedf9b724a07042fd0f564ce074
thread_identity by using a void*, and fix callers to use
base::scheduling::Schedulable::GetBoundSchedulable().
PiperOrigin-RevId: 894096577
Change-Id: I2d4c822c60501e34cadcaac7fc434ef9adb222c3