Configure ABSL_CACHE_ALIGNED for clang-like and MSVC toolchains.

PiperOrigin-RevId: 479614832
Change-Id: I440d145172c93cc4043aeda36898877a331ed5ff
pull/1292/head
Abseil Team 2 years ago committed by Copybara-Service
parent 8317b9a01c
commit d870260579
  1. 4
      absl/base/optimization.h

@ -91,6 +91,7 @@
#define ABSL_CACHELINE_SIZE 64
#endif
#endif
#endif
#ifndef ABSL_CACHELINE_SIZE
// A reasonable default guess. Note that overestimates tend to waste more
@ -141,12 +142,11 @@
// the generated machine code.
// 3) Prefer applying this attribute to individual variables. Avoid
// applying it to types. This tends to localize the effect.
#if defined(__clang__) || defined(__GNUC__)
#define ABSL_CACHELINE_ALIGNED __attribute__((aligned(ABSL_CACHELINE_SIZE)))
#elif defined(_MSC_VER)
#define ABSL_CACHELINE_SIZE 64
#define ABSL_CACHELINE_ALIGNED __declspec(align(ABSL_CACHELINE_SIZE))
#else
#define ABSL_CACHELINE_SIZE 64
#define ABSL_CACHELINE_ALIGNED
#endif

Loading…
Cancel
Save