Summary:
A bit of tidying up:
- Remove unused digit1 / digit2 arrays
- Remove unused MaxString<bool>
- Move MaxString<> entirely to Conv.cpp, as it's not used in Conv.h
- Extend anonymous namespace in Conv.cpp
- Sort headers in Conv.h
Reviewed By: yfeldblum
Differential Revision:
D3433767
fbshipit-source-id:
224a68f22505c0f2014ac376154d004eca1658a9
namespace folly {
namespace detail {
namespace folly {
namespace detail {
-extern const char digit1[101] =
- "00000000001111111111222222222233333333334444444444"
- "55555555556666666666777777777788888888889999999999";
-extern const char digit2[101] =
- "01234567890123456789012345678901234567890123456789"
- "01234567890123456789012345678901234567890123456789";
-
-template <> const char *const MaxString<bool>::value = "true";
+namespace {
+
+// Maximum value of number when represented as a string
+template <class T>
+struct MaxString {
+ static const char* const value;
+};
+
template <> const char *const MaxString<uint8_t>::value = "255";
template <> const char *const MaxString<uint16_t>::value = "65535";
template <> const char *const MaxString<uint32_t>::value = "4294967295";
template <> const char *const MaxString<uint8_t>::value = "255";
template <> const char *const MaxString<uint16_t>::value = "65535";
template <> const char *const MaxString<uint32_t>::value = "4294967295";
"340282366920938463463374607431768211455";
#endif
"340282366920938463463374607431768211455";
#endif
/*
* Lookup tables that converts from a decimal character value to an integral
* binary value, shifted by a decimal "shift" multiplier.
/*
* Lookup tables that converts from a decimal character value to an integral
* binary value, shifted by a decimal "shift" multiplier.
-#include <folly/FBString.h>
-#include <folly/Likely.h>
-#include <folly/Preprocessor.h>
-#include <folly/Range.h>
-
-#include <boost/implicit_cast.hpp>
+#include <climits>
+#include <cstddef>
#include <string>
#include <tuple>
#include <string>
#include <tuple>
+#include <boost/implicit_cast.hpp>
+#include <double-conversion/double-conversion.h> // V8 JavaScript implementation
-// V8 JavaScript implementation
-#include <double-conversion/double-conversion.h>
+#include <folly/FBString.h>
+#include <folly/Likely.h>
+#include <folly/Preprocessor.h>
+#include <folly/Range.h>
#define FOLLY_RANGE_CHECK_STRINGIZE(x) #x
#define FOLLY_RANGE_CHECK_STRINGIZE2(x) FOLLY_RANGE_CHECK_STRINGIZE(x)
#define FOLLY_RANGE_CHECK_STRINGIZE(x) #x
#define FOLLY_RANGE_CHECK_STRINGIZE2(x) FOLLY_RANGE_CHECK_STRINGIZE(x)
- // Maximum value of number when represented as a string
- template <class T> struct MaxString {
- static const char*const value;
- };
bool str_to_bool(StringPiece* src);
float str_to_float(StringPiece* src);
bool str_to_bool(StringPiece* src);
float str_to_float(StringPiece* src);