Clean up platform-dependant format strings.
[folly.git] / folly / build / GenerateFingerprintTables.cpp
index 3b330f2a4a3c0e93c448238e7f7fa3b26039d004..b39c168baf9847b9cf2447845cb4efcbd8425639 100644 (file)
  * limitations under the License.
  */
 
+#ifndef __STDC_FORMAT_MACROS
+#define __STDC_FORMAT_MACROS 1
+#endif
+
 #include <cstdio>
+#include <cinttypes>
 
 #include <string>
 
@@ -84,7 +89,7 @@ void computeTables(FILE* file, const FingerprintPolynomial<DEG>& poly) {
       "const uint64_t FingerprintTable<%d>::poly[%d] = {",
       DEG+1, FingerprintPolynomial<DEG>::size()));
   for (int j = 0; j < FingerprintPolynomial<DEG>::size(); j++) {
-    CHECK_ERR(fprintf(file, "%s%luLU", j ? ", " : "", poly_val[j]));
+    CHECK_ERR(fprintf(file, "%s%" PRIu64 "LU", j ? ", " : "", poly_val[j]));
   }
   CHECK_ERR(fprintf(file, "};\n\n"));
 
@@ -101,7 +106,8 @@ void computeTables(FILE* file, const FingerprintPolynomial<DEG>& poly) {
     for (int x = 0; x < 256; x++) {
       CHECK_ERR(fprintf(file, "    {"));
       for (int j = 0; j < FingerprintPolynomial<DEG>::size(); j++) {
-        CHECK_ERR(fprintf(file, "%s%luLU", (j ? ", " : ""), table[i][x][j]));
+        CHECK_ERR(fprintf(
+          file, "%s%" PRIu64 "LU", (j ? ", " : ""), table[i][x][j]));
       }
       CHECK_ERR(fprintf(file, "},\n"));
     }