Revert "fix configure script to check pthread_atfork(3) in the correct way"
[folly.git] / folly / GroupVarint.h
index cbfce4b06919e1f745ecaedb3754b2135a7fe77e..ff1c33c385da09eb4d5b61c9f617899a4cb4ea30 100644 (file)
 #error GroupVarint.h requires GCC
 #endif
 
-#if defined(__x86_64__) || defined(__i386__)
+#include <folly/Portability.h>
+
+#if FOLLY_X64 || defined(__i386__)
 #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/Bits.h>
+#include <folly/Range.h>
 #include <glog/logging.h>
 
 #ifdef __SSSE3__
@@ -174,7 +176,7 @@ class GroupVarint<uint32_t> : public detail::GroupVarintBase<uint32_t> {
     p += k2+1;
     size_t k3 = b3key(k);
     *d = loadUnaligned<uint32_t>(p) & kMask[k3];
-    p += k3+1;
+    // p += k3+1;
     return end;
   }
 
@@ -187,6 +189,10 @@ class GroupVarint<uint32_t> : public detail::GroupVarintBase<uint32_t> {
   }
 
 #ifdef __SSSE3__
+  /**
+   * Just like the non-SSSE3 decode below, but with the additional constraint
+   * that we must be able to read at least 17 bytes from the input pointer, p.
+   */
   static const char* decode(const char* p, uint32_t* dest) {
     uint8_t key = p[0];
     __m128i val = _mm_loadu_si128((const __m128i*)(p+1));
@@ -196,6 +202,10 @@ class GroupVarint<uint32_t> : public detail::GroupVarintBase<uint32_t> {
     return p + detail::groupVarintLengths[key];
   }
 
+  /**
+   * Just like decode_simple, but with the additional constraint that
+   * we must be able to read at least 17 bytes from the input pointer, p.
+   */
   static const char* decode(const char* p, uint32_t* a, uint32_t* b,
                             uint32_t* c, uint32_t* d) {
     uint8_t key = p[0];
@@ -607,6 +617,5 @@ typedef GroupVarintDecoder<uint64_t> GroupVarint64Decoder;
 
 }  // namespace folly
 
-#endif /* defined(__x86_64__) || defined(__i386__) */
+#endif /* FOLLY_X64 || defined(__i386__) */
 #endif /* FOLLY_GROUPVARINT_H_ */
-