Always use the 64-bit conversion function in ConvBenchmark.cpp
authorChristopher Dykes <cdykes@fb.com>
Fri, 22 Jul 2016 17:15:00 +0000 (10:15 -0700)
committerFacebook Github Bot 1 <facebook-github-bot-1-bot@fb.com>
Fri, 22 Jul 2016 17:23:51 +0000 (10:23 -0700)
Summary: A `long` on MSVC is only 4 bytes, so the `static_assert` will fail. Remove the static assert and use the `long long` version instead. Do the same for the unsigned version.

Reviewed By: yfeldblum

Differential Revision: D3601064

fbshipit-source-id: 70c5f4bca597ba05c3729f5d15feeea3cc8fde57

folly/test/ConvBenchmark.cpp

index 0c7ffd3d5496d642e958f90030373c4982acc799..0464822b84dbf7409ba85d0c57b4b4f7cbb22220 100644 (file)
@@ -317,17 +317,7 @@ void follyAtoiMeasure(unsigned int n, unsigned int digits) {
 void clibAtoiMeasure(unsigned int n, unsigned int digits) {
   auto p = pc1.subpiece(pc1.size() - digits, digits);
   assert(*p.end() == 0);
-  static_assert(sizeof(long) == 8, "64-bit long assumed");
-  FOR_EACH_RANGE(i, 0, n) { doNotOptimizeAway(atol(p.begin())); }
-}
-
-void clibStrtoulMeasure(unsigned int n, unsigned int digits) {
-  auto p = pc1.subpiece(pc1.size() - digits, digits);
-  assert(*p.end() == 0);
-  char* endptr;
-  FOR_EACH_RANGE(i, 0, n) {
-    doNotOptimizeAway(strtoul(p.begin(), &endptr, 10));
-  }
+  FOR_EACH_RANGE(i, 0, n) { doNotOptimizeAway(atoll(p.begin())); }
 }
 
 void lexicalCastMeasure(unsigned int n, unsigned int digits) {