X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=folly%2Fbuild%2FGenerateFingerprintTables.cpp;h=adf4c5dabe55d675882c738a2b8523572274a641;hb=598926c4529b459ce535657ec76ac792f4ec010e;hp=3ebb99bcd2ae12657b436704ab22f9777c27508a;hpb=ce64f0f685111ac24c7a321ea56d0c3524621df1;p=folly.git diff --git a/folly/build/GenerateFingerprintTables.cpp b/folly/build/GenerateFingerprintTables.cpp index 3ebb99bc..adf4c5da 100644 --- a/folly/build/GenerateFingerprintTables.cpp +++ b/folly/build/GenerateFingerprintTables.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2014 Facebook, Inc. + * Copyright 2017 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,15 +18,14 @@ #define __STDC_FORMAT_MACROS 1 #endif -#include #include +#include #include #include -#include -#include +#include #include @@ -71,9 +70,9 @@ void computeTables(FILE* file, const FingerprintPolynomial& poly) { // where k is the number of bits in the fingerprint (and deg(P)) and // Q(X) = q7*X^7 + q6*X^6 + ... + q1*X + q0 is a degree-7 polyonomial // whose coefficients are the bits of q. - for (int x = 0; x < 256; x++) { + for (uint16_t x = 0; x < 256; x++) { FingerprintPolynomial t; - t.setHigh8Bits(x); + t.setHigh8Bits(uint8_t(x)); for (int i = 0; i < 8; i++) { t.mulXkmod(8, poly); t.write(&(table[i][x][0])); @@ -89,7 +88,7 @@ void computeTables(FILE* file, const FingerprintPolynomial& poly) { "const uint64_t FingerprintTable<%d>::poly[%d] = {", DEG+1, FingerprintPolynomial::size())); for (int j = 0; j < FingerprintPolynomial::size(); j++) { - CHECK_ERR(fprintf(file, "%s%" PRIu64 "LU", j ? ", " : "", poly_val[j])); + CHECK_ERR(fprintf(file, "%s%" PRIu64 "LLU", j ? ", " : "", poly_val[j])); } CHECK_ERR(fprintf(file, "};\n\n")); @@ -106,8 +105,8 @@ void computeTables(FILE* file, const FingerprintPolynomial& poly) { for (int x = 0; x < 256; x++) { CHECK_ERR(fprintf(file, " {")); for (int j = 0; j < FingerprintPolynomial::size(); j++) { - CHECK_ERR(fprintf( - file, "%s%" PRIu64 "LU", (j ? ", " : ""), table[i][x][j])); + CHECK_ERR( + fprintf(file, "%s%" PRIu64 "LLU", (j ? ", " : ""), table[i][x][j])); } CHECK_ERR(fprintf(file, "},\n")); } @@ -116,14 +115,13 @@ void computeTables(FILE* file, const FingerprintPolynomial& poly) { CHECK_ERR(fprintf(file, "\n};\n\n")); } -} // namespace +} // namespace int main(int argc, char *argv[]) { - google::ParseCommandLineFlags(&argc, &argv, true); + gflags::ParseCommandLineFlags(&argc, &argv, true); google::InitGoogleLogging(argv[0]); - std::string name = folly::format("{}/{}", FLAGS_install_dir, - "FingerprintTables.cpp").str(); + std::string name = FLAGS_install_dir + "/" + "FingerprintTables.cpp"; FILE* file = fopen(name.c_str(), "w"); PCHECK(file);