X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=folly%2FGroupVarint.h;h=ad0bb361cf59620e229886ab2696d33152c75618;hb=b2ae6ce3b6fc237e85cc988ad4a47a8453250b88;hp=8a101d51ec5b889038e939bf1f9218b88482522f;hpb=520e20a8baebc98a5ec84d67865da4cf9819f88a;p=folly.git diff --git a/folly/GroupVarint.h b/folly/GroupVarint.h index 8a101d51..ad0bb361 100644 --- a/folly/GroupVarint.h +++ b/folly/GroupVarint.h @@ -27,12 +27,12 @@ #include -#if FOLLY_X64 || defined(__i386__) || FOLLY_PPC64 || FOLLY_A64 +#if FOLLY_X64 || defined(__i386__) || FOLLY_PPC64 || FOLLY_AARCH64 #define HAVE_GROUP_VARINT 1 -#include #include #include +#include #include #if FOLLY_SSE >= 3 @@ -40,15 +40,15 @@ 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 { @@ -107,13 +107,21 @@ class GroupVarint : public detail::GroupVarintBase { 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; } @@ -312,15 +320,25 @@ class GroupVarint : public detail::GroupVarintBase { uint16_t v = loadUnaligned(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; } @@ -625,6 +643,6 @@ class GroupVarintDecoder { typedef GroupVarintDecoder GroupVarint32Decoder; typedef GroupVarintDecoder GroupVarint64Decoder; -} // namespace folly +} // namespace folly #endif /* FOLLY_X64 || defined(__i386__) || FOLLY_PPC64 */