From 38b106f1626167d0ab05bf6b35c0de07be3d5eb3 Mon Sep 17 00:00:00 2001 From: Christopher Dykes Date: Fri, 22 Jul 2016 10:15:00 -0700 Subject: [PATCH] Always use the 64-bit conversion function in ConvBenchmark.cpp 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 | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/folly/test/ConvBenchmark.cpp b/folly/test/ConvBenchmark.cpp index 0c7ffd3d..0464822b 100644 --- a/folly/test/ConvBenchmark.cpp +++ b/folly/test/ConvBenchmark.cpp @@ -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) { -- 2.34.1