Fix undefined behaviour in 128-bit integer-to-string conversion
[folly.git] / folly / test / FBStringBenchmark.cpp
index c7fdbf5133e4d8bf891fd75818f33ff2086c8e4f..086c8ae5101c36f851a18f839996ab9384a0adcb 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2015 Facebook, Inc.
+ * Copyright 2016 Facebook, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 #include <folly/FBString.h>
 
 #include <cstdlib>
-
 #include <list>
 #include <fstream>
 #include <sstream>
+
 #include <boost/algorithm/string.hpp>
 #include <boost/random.hpp>
 
-#include <gflags/gflags.h>
-
+#include <folly/Benchmark.h>
 #include <folly/Foreach.h>
 #include <folly/Random.h>
-#include <folly/Benchmark.h>
+#include <folly/portability/GFlags.h>
 
 using namespace std;
 using namespace folly;
@@ -47,18 +46,18 @@ Integral2 random(Integral1 low, Integral2 up) {
 }
 
 template <class String>
-void randomString(String* toFill, unsigned int maxSize = 1000) {
+void randomString(String* toFill, size_t size = 1000) {
   assert(toFill);
-  toFill->resize(random(0, maxSize));
+  toFill->resize(size);
   FOR_EACH (i, *toFill) {
     *i = random('a', 'z');
   }
 }
 
 template <class String>
-void randomBinaryString(String* toFill, unsigned int maxSize = 1000) {
+void randomBinaryString(String* toFill, size_t size = 1000) {
   assert(toFill);
-  toFill->resize(random(0, maxSize));
+  toFill->resize(size);
   FOR_EACH (i, *toFill) {
     *i = random('0', '1');
   }