#pragma once
+#include <cstdint>
+#include <limits>
+
+#include <glog/logging.h>
+
#if !defined(__GNUC__) && !defined(_MSC_VER)
#error GroupVarint.h requires GCC or MSVC
#endif
#include <folly/Portability.h>
-#if FOLLY_X64 || defined(__i386__) || FOLLY_PPC64 || FOLLY_A64
+#if FOLLY_X64 || defined(__i386__) || FOLLY_PPC64 || FOLLY_AARCH64
#define HAVE_GROUP_VARINT 1
-#include <cstdint>
-#include <limits>
-#include <folly/detail/GroupVarintDetail.h>
#include <folly/Bits.h>
#include <folly/Range.h>
+#include <folly/detail/GroupVarintDetail.h>
#include <folly/portability/Builtins.h>
-#include <glog/logging.h>
#if FOLLY_SSE >= 3
#include <nmmintrin.h>
namespace folly {
namespace detail {
alignas(16) extern const uint64_t groupVarintSSEMasks[];
-} // namespace detail
-} // namespace folly
+} // namespace detail
+} // namespace folly
#endif
namespace folly {
namespace detail {
extern const uint8_t groupVarintLengths[];
-} // namespace detail
-} // namespace folly
+} // namespace detail
+} // namespace folly
namespace folly {
uint8_t v = uint8_t(*p);
size_t s = kHeaderSize;
s += 1 + b0key(v);
- if (s > size) return 0;
+ if (s > size) {
+ return 0;
+ }
s += 1 + b1key(v);
- if (s > size) return 1;
+ if (s > size) {
+ return 1;
+ }
s += 1 + b2key(v);
- if (s > size) return 2;
+ if (s > size) {
+ return 2;
+ }
s += 1 + b3key(v);
- if (s > size) return 3;
+ if (s > size) {
+ return 3;
+ }
return 4;
}
uint16_t v = loadUnaligned<uint16_t>(p);
size_t s = kHeaderSize;
s += 1 + b0key(v);
- if (s > size) return 0;
+ if (s > size) {
+ return 0;
+ }
s += 1 + b1key(v);
- if (s > size) return 1;
+ if (s > size) {
+ return 1;
+ }
s += 1 + b2key(v);
- if (s > size) return 2;
+ if (s > size) {
+ return 2;
+ }
s += 1 + b3key(v);
- if (s > size) return 3;
+ if (s > size) {
+ return 3;
+ }
s += 1 + b4key(v);
- if (s > size) return 4;
+ if (s > size) {
+ return 4;
+ }
return 5;
}
typedef GroupVarintDecoder<uint32_t> GroupVarint32Decoder;
typedef GroupVarintDecoder<uint64_t> GroupVarint64Decoder;
-} // namespace folly
+} // namespace folly
#endif /* FOLLY_X64 || defined(__i386__) || FOLLY_PPC64 */