Remove folly/detail/UncaughtExceptionCounter.h
[folly.git] / folly / build / generate_varint_tables.py
index 60fe683e0767a2b5d7e3ad5a94047347842b275f..b121a205c399f8a6d5c8a5b39ed8f4feefc19584 100755 (executable)
@@ -52,16 +52,15 @@ OUTPUT_FILE = "GroupVarintTables.cpp"
 
 def generate(f):
     f.write("""
-#include "folly/Portability.h"
+#include <folly/Portability.h>
 
-#if FOLLY_X64 || defined(__i386__)
 #include <stdint.h>
-#include <x86intrin.h>
 
 namespace folly {
 namespace detail {
 
-extern const __m128i groupVarintSSEMasks[] = {
+#if (FOLLY_X64 || defined(__i386__)) && (FOLLY_SSE >= 2)
+alignas(16) extern const uint64_t groupVarintSSEMasks[512] = {
 """)
 
     # Compute SSE masks
@@ -78,12 +77,13 @@ extern const __m128i groupVarintSSEMasks[] = {
             # 0xff: set corresponding byte in result to 0
             for k in range(d, 4):
                 vals[j] |= 0xff << (8 * k)
-        f.write("  {{static_cast<int64_t>(0x{1:08x}{0:08x}), "
-            "static_cast<int64_t>(0x{3:08x}{2:08x})}},\n".format(*vals))
+        f.write("  0x{1:08x}{0:08x}ULL, "
+            "0x{3:08x}{2:08x}ULL,\n".format(*vals))
 
     f.write("};\n"
-            "\n"
-            "extern const uint8_t groupVarintLengths[] = {\n")
+        "#endif /*#if (FOLLY_X64 || defined(__i386__)) && (FOLLY_SSE >= 2)*/\n"
+        "\n"
+        "extern const uint8_t groupVarintLengths[] = {\n")
 
     # Also compute total encoded lengths, including key byte
     for i in range(0, 256):
@@ -96,9 +96,8 @@ extern const __m128i groupVarintSSEMasks[] = {
     f.write("""
 };
 
-}  // namespace detail
-}  // namespace folly
-#endif /* FOLLY_X64 || defined(__i386__) */
+} // namespace detail
+} // namespace folly
 """)
 
 def main():