summaryrefslogtreecommitdiff
path: root/absl/strings/internal/str_format/extension.h
diff options
context:
space:
mode:
authorGravatar Abseil Team <absl-team@google.com>2018-09-12 11:03:25 -0700
committerGravatar Gennadiy Civil <misterg@google.com>2018-09-13 13:24:44 -0400
commit8ff1374008259719b54a8cb128ef951c02da164c (patch)
treed6768eeb981f8e3a14668c329336faee20291346 /absl/strings/internal/str_format/extension.h
parent02451914b9ad5320f81f56a89f3eef1f8683227c (diff)
Export of internal Abseil changes.
-- 821196cfb2a3b943ffdc4c9e75daec92d7ffb28b by Abseil Team <absl-team@google.com>: Performance improvements PiperOrigin-RevId: 212668992 -- 704858e2e767016bad27d53eec01d9d48e546b23 by Abseil Team <absl-team@google.com>: Low-level Portability enchancements for Abseil Mutex on WebAssembly. Emscripten Pthreads do not use signals, so remove use of pthread_sigmask or other async-signal-safe related handling code. PiperOrigin-RevId: 212527958 -- be3e38cb4d493b755132d20c8c2d1a51e45d5449 by Jon Cohen <cohenjon@google.com>: Internal change. PiperOrigin-RevId: 212523797 GitOrigin-RevId: 821196cfb2a3b943ffdc4c9e75daec92d7ffb28b Change-Id: I5694e23e4e09364a15dd6fc4e2e3f15e38835687
Diffstat (limited to 'absl/strings/internal/str_format/extension.h')
-rw-r--r--absl/strings/internal/str_format/extension.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/absl/strings/internal/str_format/extension.h b/absl/strings/internal/str_format/extension.h
index f43195c1..11b996ae 100644
--- a/absl/strings/internal/str_format/extension.h
+++ b/absl/strings/internal/str_format/extension.h
@@ -18,6 +18,7 @@
#define ABSL_STRINGS_INTERNAL_STR_FORMAT_EXTENSION_H_
#include <limits.h>
+#include <cstddef>
#include <cstring>
#include <ostream>
@@ -307,7 +308,12 @@ class ConversionSpec {
public:
Flags flags() const { return flags_; }
LengthMod length_mod() const { return length_mod_; }
- ConversionChar conv() const { return conv_; }
+ ConversionChar conv() const {
+ // Keep this field first in the struct . It generates better code when
+ // accessing it when ConversionSpec is passed by value in registers.
+ static_assert(offsetof(ConversionSpec, conv_) == 0, "");
+ return conv_;
+ }
// Returns the specified width. If width is unspecfied, it returns a negative
// value.
@@ -324,9 +330,9 @@ class ConversionSpec {
void set_left(bool b) { flags_.left = b; }
private:
+ ConversionChar conv_;
Flags flags_;
LengthMod length_mod_;
- ConversionChar conv_;
int width_;
int precision_;
};