Commit 38b106f1 authored by Christopher Dykes's avatar Christopher Dykes Committed by Facebook Github Bot 1

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
parent eeb9d4e9
...@@ -317,17 +317,7 @@ void follyAtoiMeasure(unsigned int n, unsigned int digits) { ...@@ -317,17 +317,7 @@ void follyAtoiMeasure(unsigned int n, unsigned int digits) {
void clibAtoiMeasure(unsigned int n, unsigned int digits) { void clibAtoiMeasure(unsigned int n, unsigned int digits) {
auto p = pc1.subpiece(pc1.size() - digits, digits); auto p = pc1.subpiece(pc1.size() - digits, digits);
assert(*p.end() == 0); assert(*p.end() == 0);
static_assert(sizeof(long) == 8, "64-bit long assumed"); FOR_EACH_RANGE(i, 0, n) { doNotOptimizeAway(atoll(p.begin())); }
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));
}
} }
void lexicalCastMeasure(unsigned int n, unsigned int digits) { void lexicalCastMeasure(unsigned int n, unsigned int digits) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment