Export of internal Abseil changes.
-- ed3a3431eee9e48e6553b0320e0308d2dde6725c by Derek Mauro <dmauro@google.com>: Project import generated by Copybara. PiperOrigin-RevId: 258631680 GitOrigin-RevId: ed3a3431eee9e48e6553b0320e0308d2dde6725c Change-Id: I1d7ae86a79783842092d29504605ba039c369603
This commit is contained in:
parent
44efe96dfc
commit
c6c3c1b498
32 changed files with 1168 additions and 657 deletions
|
|
@ -24,24 +24,16 @@ namespace absl {
|
|||
// so in debug builds we always use the slower implementation, which always
|
||||
// validates the type.
|
||||
#ifndef NDEBUG
|
||||
#define ABSL_FLAGS_ATOMIC_GET(T) \
|
||||
T GetFlag(const absl::Flag<T>& flag) { \
|
||||
T result; \
|
||||
flag.internal.Read(&result, &flags_internal::FlagOps<T>); \
|
||||
return result; \
|
||||
}
|
||||
#define ABSL_FLAGS_ATOMIC_GET(T) \
|
||||
T GetFlag(const absl::Flag<T>& flag) { return flag.Get(); }
|
||||
#else
|
||||
#define ABSL_FLAGS_ATOMIC_GET(T) \
|
||||
T GetFlag(const absl::Flag<T>& flag) { \
|
||||
const int64_t r = flag.internal.atomic.load(std::memory_order_acquire); \
|
||||
if (r != flags_internal::CommandLineFlag::kAtomicInit) { \
|
||||
T t; \
|
||||
memcpy(&t, &r, sizeof(T)); \
|
||||
return t; \
|
||||
} \
|
||||
T result; \
|
||||
flag.internal.Read(&result, &flags_internal::FlagOps<T>); \
|
||||
return result; \
|
||||
#define ABSL_FLAGS_ATOMIC_GET(T) \
|
||||
T GetFlag(const absl::Flag<T>& flag) { \
|
||||
T result; \
|
||||
if (flag.AtomicGet(&result)) { \
|
||||
return result; \
|
||||
} \
|
||||
return flag.Get(); \
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue