- 06 Jul, 2016 3 commits
-
-
Marcus Holland-Moritz authored
Summary: This is the main diff of the series. Its main purpose is to make the internals of folly::to<> propagate error codes instead of throwing exceptions. Along with this, it makes the following changes: - Move most of the string-to-int implementation out of the header file - Unify error/exception strings across conversion routines - Introduce a ConversionError class that derives from std::range_error - Capture an error code in ConversionError in addition to a string - Optimize tolower() calls in Conv.cpp - Introduce ConversionResult<>, which is used as the internal result wrapper - Get rid of all error checking macros There are quite a few benefits here. == Faster conversions == For a large set of conversions, the performance is unchanged. I've removed all benchmarks that were unchanged from the table below for simplicity. A few things stand out: - `follyAtoiMeasure` is consistently faster, sometimes by quite a large margin - The cost of throwing exceptions is significantly reduced, as throwing them further down on the call stack will reduce the amount of stack unwinding - String-to-boolean and string-to-float conversions are significantly faster when passing in a string representation (e.g. "off" or "infinity") thanks to the optimized tolower_ascii() call (column `New+Ascii` in the table) - Conversions between int and float are significantly faster and almost back at the performance of before the undefined behaviour fix - All string-to-(int|float|bool) conversions are consistently faster The columns in the table are as follows: Original: Original code before the undefined behaviour fix Fix UB: Code with the undefined behaviour fix; this impacts mostly the float <-> int conversions, but appears to have a small effect on some other benchmarks New: New code introduced by this diff, but without the tolower_ascii() optimization New+Ascii: New code, including the tolower_ascii() optimization =========================================================================================== Original Fix UB New New+Ascii folly/test/ConvBenchmark.cpp time/iter time/iter time/iter time/iter =========================================================================================== handwrittenAtoiMeasure(1) 3.95ns 3.95ns 3.95ns 3.95ns follyAtoiMeasure(1) 6.08ns 6.08ns 3.95ns 3.95ns ------------------------------------------------------------------------------------------- handwrittenAtoiMeasure(2) 5.47ns 5.47ns 5.47ns 5.47ns follyAtoiMeasure(2) 5.77ns 5.77ns 3.95ns 3.95ns ------------------------------------------------------------------------------------------- handwrittenAtoiMeasure(3) 6.08ns 6.08ns 6.08ns 6.08ns follyAtoiMeasure(3) 6.08ns 6.08ns 4.25ns 4.25ns ------------------------------------------------------------------------------------------- handwrittenAtoiMeasure(4) 6.99ns 6.99ns 6.99ns 6.99ns follyAtoiMeasure(4) 6.99ns 6.99ns 4.56ns 4.56ns ------------------------------------------------------------------------------------------- handwrittenAtoiMeasure(5) 7.90ns 8.20ns 7.90ns 7.90ns follyAtoiMeasure(5) 7.29ns 7.29ns 4.86ns 4.86ns ------------------------------------------------------------------------------------------- handwrittenAtoiMeasure(6) 8.81ns 9.42ns 8.81ns 8.81ns follyAtoiMeasure(6) 7.29ns 7.29ns 4.86ns 4.86ns ------------------------------------------------------------------------------------------- handwrittenAtoiMeasure(7) 9.72ns 10.63ns 9.72ns 9.72ns follyAtoiMeasure(7) 7.60ns 7.60ns 5.16ns 5.16ns ------------------------------------------------------------------------------------------- handwrittenAtoiMeasure(8) 10.63ns 11.85ns 10.63ns 10.63ns follyAtoiMeasure(8) 8.51ns 8.51ns 6.08ns 6.08ns ------------------------------------------------------------------------------------------- handwrittenAtoiMeasure(9) 11.54ns 13.07ns 11.54ns 11.54ns follyAtoiMeasure(9) 8.81ns 8.81ns 6.08ns 6.08ns ------------------------------------------------------------------------------------------- handwrittenAtoiMeasure(10) 12.46ns 14.28ns 12.46ns 12.46ns follyAtoiMeasure(10) 8.81ns 8.81ns 6.38ns 6.38ns ------------------------------------------------------------------------------------------- handwrittenAtoiMeasure(11) 13.37ns 15.50ns 13.37ns 13.37ns follyAtoiMeasure(11) 9.12ns 9.12ns 6.38ns 6.38ns ------------------------------------------------------------------------------------------- handwrittenAtoiMeasure(12) 14.28ns 16.71ns 14.28ns 14.28ns follyAtoiMeasure(12) 10.03ns 10.03ns 7.29ns 7.29ns ------------------------------------------------------------------------------------------- handwrittenAtoiMeasure(13) 15.19ns 17.92ns 15.19ns 15.19ns follyAtoiMeasure(13) 10.33ns 10.33ns 7.60ns 7.60ns ------------------------------------------------------------------------------------------- handwrittenAtoiMeasure(14) 16.10ns 19.14ns 16.10ns 16.10ns follyAtoiMeasure(14) 10.33ns 10.33ns 7.60ns 7.60ns ------------------------------------------------------------------------------------------- handwrittenAtoiMeasure(15) 17.01ns 20.36ns 17.01ns 17.01ns follyAtoiMeasure(15) 10.63ns 10.63ns 7.90ns 7.90ns ------------------------------------------------------------------------------------------- handwrittenAtoiMeasure(16) 17.92ns 21.57ns 17.92ns 17.92ns follyAtoiMeasure(16) 11.55ns 11.55ns 8.81ns 8.81ns ------------------------------------------------------------------------------------------- handwrittenAtoiMeasure(17) 18.84ns 22.79ns 18.84ns 18.84ns follyAtoiMeasure(17) 11.85ns 11.85ns 8.81ns 8.81ns ------------------------------------------------------------------------------------------- handwrittenAtoiMeasure(18) 19.75ns 24.00ns 19.75ns 19.75ns follyAtoiMeasure(18) 11.85ns 11.85ns 9.12ns 9.12ns ------------------------------------------------------------------------------------------- handwrittenAtoiMeasure(19) 20.66ns 25.22ns 20.66ns 20.66ns follyAtoiMeasure(19) 12.16ns 12.16ns 9.11ns 9.11ns ------------------------------------------------------------------------------------------- stringToBoolNumClassic 12.76ns 12.76ns 11.96ns 12.15ns stringToBoolNumClassicError 3.19us 3.18us 1.58us 1.58us stringToBoolStrClassic 17.92ns 17.92ns 15.50ns 7.60ns stringToBoolStrClassicError 3.21us 3.18us 1.57us 1.57us ------------------------------------------------------------------------------------------- stringToFloatNumClassic 32.96ns 32.81ns 32.10ns 31.12ns stringToFloatNumClassicError 2.73us 2.69us 1.65us 1.66us stringToFloatStrClassic 37.37ns 38.58ns 36.76ns 16.71ns stringToFloatStrClassicError 2.87us 2.87us 1.60us 1.59us stringToDoubleNumClassic 31.30ns 31.82ns 29.77ns 29.17ns stringToDoubleNumClassicError 2.69us 2.66us 1.65us 1.66us stringToDoubleStrClassic 37.67ns 37.67ns 35.84ns 16.71ns stringToDoubleStrClassicError 2.87us 2.86us 1.58us 1.58us ------------------------------------------------------------------------------------------- stringToCharSignedClassic 16.71ns 18.08ns 15.49ns 14.59ns stringToCharSignedClassicError 3.87us 3.82us 1.61us 1.61us stringToCharUnsignedClassic 15.49ns 15.19ns 12.46ns 12.66ns stringToCharUnsignedClassicError 2.73us 2.70us 1.62us 1.62us stringToIntSignedClassic 21.26ns 19.44ns 17.92ns 18.40ns stringToIntSignedClassicError 3.94us 3.89us 1.64us 1.64us stringToIntUnsignedClassic 17.93ns 18.53ns 15.50ns 15.50ns stringToIntUnsignedClassicError 2.72us 2.71us 1.62us 1.61us stringToLongLongSignedClassic 34.63ns 30.58ns 27.04ns 27.04ns stringToLongLongSignedClassicError 3.94us 3.90us 1.63us 1.63us stringToLongLongUnsignedClassic 51.04ns 47.96ns 46.44ns 46.68ns stringToLongLongUnsignedClassicError 2.73us 2.71us 1.61us 1.61us ------------------------------------------------------------------------------------------- ptrPairToCharSignedClassic 5.16ns 5.16ns 3.34ns 3.65ns ptrPairToCharSignedClassicError 3.56us 3.54us 1.61us 1.61us ptrPairToCharUnsignedClassic 2.43ns 2.43ns 2.13ns 2.13ns ptrPairToCharUnsignedClassicError 2.63us 2.63us 1.61us 1.61us ptrPairToIntSignedClassic 6.99ns 6.99ns 5.16ns 5.16ns ptrPairToIntSignedClassicError 4.08us 4.06us 1.61us 1.61us ptrPairToIntUnsignedClassic 4.25ns 4.56ns 3.34ns 3.34ns ptrPairToIntUnsignedClassicError 2.70us 2.70us 1.60us 1.60us ptrPairToLongLongSignedClassic 12.16ns 12.16ns 9.72ns 9.72ns ptrPairToLongLongSignedClassicError 4.06us 4.06us 1.61us 1.61us ptrPairToLongLongUnsignedClassic 29.13ns 29.13ns 27.61ns 27.61ns ptrPairToLongLongUnsignedClassicError 2.71us 2.72us 1.63us 1.64us ------------------------------------------------------------------------------------------- intToCharSignedClassic 405.02ps 506.35ps 405.02ps 405.02ps intToCharSignedClassicError 2.10us 2.09us 1.63us 1.64us intToCharUnsignedClassic 303.79ps 303.78ps 303.77ps 303.77ps intToCharUnsignedClassicError 2.10us 2.09us 1.63us 1.64us intToIntSignedClassic 405.02ps 405.02ps 405.01ps 405.01ps intToIntSignedClassicError 1.99us 1.98us 1.72us 1.72us intToIntUnsignedClassic 405.03ps 405.03ps 379.71ps 379.71ps intToIntUnsignedClassicError 2.09us 2.09us 1.63us 1.63us ------------------------------------------------------------------------------------------- intToFloatClassic 545.11ps 3.34ns 1.23ns 1.23ns intToFloatClassicError 1.67us 2.37us 1.73us 1.72us ------------------------------------------------------------------------------------------- floatToFloatClassic 759.47ps 759.47ps 759.45ps 759.45ps floatToFloatClassicError 6.45us 6.44us 1.77us 1.77us ------------------------------------------------------------------------------------------- floatToIntClassic 637.82ps 2.89ns 1.50ns 1.50ns floatToIntClassicError 1.92us 2.61us 1.82us 1.83us =========================================================================================== == Improved build times == I've checked this with gcc 4.9.3, and compile times for both ConvTest and ConvBenchmark are reduced by roughly 10%: ==================================== original new code ------------------------------------ ConvTest.o 14.788s 13.361s ConvBenchmark.o 16.148s 14.578s ==================================== == Smaller binary size == Again, checked with gcc 4.9.3, stripped binaries are slightly smaller with the new code: ==================================== original new code ------------------------------------ conv_test 761704 749384 conv_benchmark 539632 510928 ==================================== == Ability to add new non-throwing interfaces == This change sticks to the original API that will throw an exception in case of an error. A subsequent diff will introduce non-throwing interfaces with a minimum of additional code. Reviewed By: ericniebler Differential Revision: D3433856 fbshipit-source-id: 9bc976ebc181fe2f172ae47c78edf407e9ee7bb0
-
Adam Simpkins authored
Summary: Update the Synchronized code to use the new LockTraits added in D3504625. This also removes the acquireRead*() and releaseRead*() adapter functions that had been defined for various other lock types, which are no longer needed. Reviewed By: yfeldblum Differential Revision: D3512310 fbshipit-source-id: daedd47c0378aebd479dbfe7aba24978deb9cc05
-
Adam Simpkins authored
Summary: This adds a new LockTraits template class, for specifying how to use arbitrary custom mutex types. The goal of this new class is to replace the acquireRead(), acquireReadWrite(), releaseRead(), and releaseReadWrite() functions currently defined in Synchronized.h. I have not replaced these functions yet in this diff, but will do so in a follow-up diff. LockTraits has a few advantages over the existing methods: * It provides mechanisms for telling if a given mutex supports shared access and timed access. * The default LockTraits implementation automatically figures out the correct behavior for classes that define lock(), unlock(), methods. It automatically detects sharing and timed support based on the presence of lock_shared() and try_lock_for() methods. LockTraits can be specialized for custom lock types that do not conform with the lock method names used by the C++ standard. This does differ slightly from the argument dependent lookup mechanism used by the acquireRead() functions. Reviewed By: yfeldblum Differential Revision: D3504625 fbshipit-source-id: 40320997e9ae2147baecd10b70e8dc06a35e49e1
-
- 05 Jul, 2016 3 commits
-
-
Andrii Grynenko authored
Summary: ~PthreadKeyUnregister logic is not safe if we can't guarantee that it has the maximum pririty (i.e. is the last to be run on shutdown). Reviewed By: ericniebler Differential Revision: D3517589 fbshipit-source-id: 3340e2e19cf52973ee677288bc4ac6105f3f2543
-
Adam Simpkins authored
Summary: In the ConnectTFOTimeout and ConnectTFOFallbackTimeout tests in AsyncSSLSocketTest.cpp, the client runs for 1ms before timing out and quitting. It may end up shutting down the server thread before the server has even received the TCP connect callback. If this happened it would cause the test to fail, since the server code checked to make sure the callback was invoked. This diff creates a new ConnectTimeoutCallback server-side callback for these tests to use, which doesn't care if it gets told about a new connection or not. Reviewed By: siyengar Differential Revision: D3512809 fbshipit-source-id: ce77fe944fb06a38a84c1458356f161cec7387b3
-
Subodh Iyengar authored
Summary: Some platforms like Apple add a additional field to sockaddr called sa_len. This is not normally required by POSIX, so all posix methods work correctly when a sockaddr is passed in without a sa_len set. However other functions which are not defined by posix such as connectx require this field to operate correctly. Reviewed By: yfeldblum Differential Revision: D3514266 fbshipit-source-id: f8e2941f337222486c81c911dbd06a2ce35e4f00
-
- 02 Jul, 2016 8 commits
-
-
Jim Meyering authored
Summary: The ThreadLocal.SharedLibrary test would fail when compiled with any sanitizer. Skip that test when any sanitizer is enabled. Reviewed By: Mizuchi Differential Revision: D3508099 fbshipit-source-id: 0419269f6454ee4edb93fe00b6f0e79756e609d0
-
Christopher Dykes authored
Summary: There are two types of includes this adds. The first are standard library headers that weer previously included by transitive dependencies, but aren't included under MSVC, so need to be explicitly included. The second type is a couple of portability headers. Reviewed By: yfeldblum Differential Revision: D3513196 fbshipit-source-id: 4f2ac1207aee887ba41c19f5490003e5fe4088f4
-
Christopher Dykes authored
Summary: Because MSVC doesn't let you do this. Separate the tests out and disable the entire thing instead. Reviewed By: yfeldblum Differential Revision: D3513174 fbshipit-source-id: 7411418204083f172883ca96eff3785c912a9647
-
Christopher Dykes authored
Summary: Because MSVC doesn't support VLAs. Reviewed By: yfeldblum Differential Revision: D3513143 fbshipit-source-id: 256e9e843004a3c37821b3dddc6ecd4c6b5645d9
-
Christopher Dykes authored
Summary: As per http://en.cppreference.com/w/cpp/numeric/random/uniform_int_distribution the behavior of using `uint8_t` as the template parameter is undefined, and is not supported on MSVC, so use `unsigned short` instead, which is a defined form. Reviewed By: yfeldblum Differential Revision: D3507309 fbshipit-source-id: c4c830371d08aee4a3de90bb394d22d92ad9a575
-
Christopher Dykes authored
Summary: Because MSVC doesn't support VLA's. Reviewed By: yfeldblum Differential Revision: D3507441 fbshipit-source-id: a50bdbad31674d236e4994903c75232d70f32bc0
-
Christopher Dykes authored
Summary: Which means `.native()` returns a `wstring`, and `.c_str()` returns a `wchar_t*`. As we're using them in places expecting a `char*`, convert to `string` first. Reviewed By: yfeldblum Differential Revision: D3506911 fbshipit-source-id: ca34b9888f98106914438490bbd860f9b922ad5e
-
Aravind Anbudurai authored
Summary: I introduced a helper method to make an AutoTimer and forced default move-ctor. That caused moved object's destruction to log and that is undesirable. This defines a custom move-ctor to set a direct the moved object to not log. Reviewed By: yfeldblum Differential Revision: D3511206 fbshipit-source-id: 38ae6de5fe76077c5e5ed10f64ebe959f5674fa7
-
- 01 Jul, 2016 16 commits
-
-
Adam Simpkins authored
Summary: The ThreadLocalTest has been broken in open source builds ever since D2678401, because Makefile.am was never updated to build the helper shared library needed by the test. This updates Makefile.am to build the shared library. Reviewed By: yfeldblum Differential Revision: D3511125 fbshipit-source-id: 4684dbc32acf6ffbfc07079da91a1da480259502
-
Aravind Anbudurai authored
Summary: Currently, AutoTimer outputs duration as a double with seconds as units. This is limiting and I'm making it return std::chrono::duration. Users can specify the type with DurationType. This is needed for me because the library that I am going to use inside the callback I pass in using chrono::duration and it feels hacky to go from duration -> double -> duration. Reviewed By: yfeldblum Differential Revision: D3506557 fbshipit-source-id: 0a5e9e16181bfac3a10df6a253716c0499cff5df
-
Christopher Dykes authored
Summary: As per http://en.cppreference.com/w/cpp/concept/UniformRandomBitGenerator it was almost there, except that `min()` and `max()` need to be static members. Reviewed By: yfeldblum Differential Revision: D3507595 fbshipit-source-id: 5e0b321c477e37ab8a3487ad643caa83cc6cfc9d
-
Aravind Anbudurai authored
Summary: Somehow the formatting is messed up and it was triggering my OCD. Sending a diff before I go crazy Depends on D3506557 Reviewed By: yfeldblum Differential Revision: D3506618 fbshipit-source-id: 218ce2100cc45c5017328e97344029061fe2eff5
-
Christopher Dykes authored
Summary: MSVC doesn't support them, so use `__VA_ARGS__` instead. Reviewed By: yfeldblum Differential Revision: D3507071 fbshipit-source-id: 186834c87e74257c709fcbc08e3bda7b1b55d02b
-
Christopher Dykes authored
Summary: The portability headers exist for a reason, so use them. Reviewed By: yfeldblum Differential Revision: D3507031 fbshipit-source-id: f88c8ed37e648d38231c1d923c1d69d551beabff
-
Christopher Dykes authored
Summary: Because MSVC doesn't support strings with multi-byte Unicode code points in them unless it's in a UTF-8 string. Reviewed By: yfeldblum Differential Revision: D3507197 fbshipit-source-id: 27bff1efee03180716418fbfa9ef98f9c04929d9
-
Christopher Dykes authored
Summary: Because `typeof` is a GCC specific extension whose standardized version is called `decltype`. Reviewed By: yfeldblum Differential Revision: D3506960 fbshipit-source-id: 0e7495028632b23f149bf8d0163d2000ebec2fcc
-
Christopher Dykes authored
Summary: Because `SIZE` is a defined type on Windows. Reviewed By: yfeldblum Differential Revision: D3507144 fbshipit-source-id: ee9fd9bb7c35055ca69719717aa10d8e9c8701c2
-
Christopher Dykes authored
Summary: Because `uint32_t` is standardized, and MSVC doesn't have `uint`. Reviewed By: yfeldblum Differential Revision: D3507011 fbshipit-source-id: ac0abb4ad1b2dbaa890554589817ce75abdd987e
-
Christopher Dykes authored
Summary: Because MSVC doesn't support VLAs. Reviewed By: yfeldblum Differential Revision: D3506835 fbshipit-source-id: 8683b5c513ed25e7f47642c8493f8b10da9906be
-
Christopher Dykes authored
Summary: MSVC was correctly warning that we were initializing `float` variables with `double` literals. This just adds the explicit suffix so they are `float` literals instead. Reviewed By: yfeldblum Differential Revision: D3506797 fbshipit-source-id: 7eb4588958eddb984ba830e2599ac505d495783e
-
Christopher Dykes authored
Summary: Thus `1UL << 63 == 0` which is not the intended behavior. Reviewed By: yfeldblum Differential Revision: D3478480 fbshipit-source-id: a31dba7f5a503be2b34a4cb66bc7039076f158a0
-
Christopher Dykes authored
Summary: THe issue is quite simple: Regardless of the control flow, the previous implementation of this was instantiating `ApplyVisitor1<V,R>` which declares a return type, but never returns. This refactors `ApplyVisitor1` and `ApplyConstVisitor1` so that the part of the control flow that was previously never reached simply doesn't exist anymore. Reviewed By: yfeldblum Differential Revision: D3479584 fbshipit-source-id: 605a48e39bba6dc14df1af1e76b55ea60f3e69d5
-
Christopher Dykes authored
Summary: Because it is defined as a macro that calls a function to get the error stream. It is also defined as a macro in musl libc. Reviewed By: yfeldblum Differential Revision: D3506283 fbshipit-source-id: 0652288adfe64010798017e46d962fdc18d2ff56
-
Misha Shneerson authored
Summary: moved stop_watch to folly defined aliases for backward compact. These alias will be removed in next diff. Reviewed By: juchem Differential Revision: D3474035 fbshipit-source-id: 74ee8bb7f2db46434c937eecf121d1cba473178a
-
- 30 Jun, 2016 3 commits
-
-
Tianjiao Yin authored
Reviewed By: yfeldblum Differential Revision: D3501266 fbshipit-source-id: 2ac3b6e2785792ccc45f4568ceff7fd05f0262f3
-
Aravind Anbudurai authored
Summary: Currently, AutoTimer works only with FunctionObjects that are default constructible because it constructs Logger each time it needs to log. This diff makes AutoTimer work with closures too. This will help in making AutoTimer more flexible because the user can capture necessary dependencies in the lambda. This diff also cleans up the constructors on AutoTimer by making it take an std::string&& instead of Args... that is passed into folly::to<..>. Although this makes the instantiation a bit harder, the simplicity of constructor seems worth it. This also refactors the callsites of setMinLogTime to directly pass the value into the ctor and changes callsites on fbcode Reviewed By: yfeldblum Differential Revision: D3487868 fbshipit-source-id: 52fa1099a5e39b791972cc0d3f678d44ea4ba288
-
Scott Michelson authored
Summary: This gives each eventbase a wheeltimer. Construction is on demand, so there's no penalty if it isn't used. Why do this? 3 immediate reasons: 1) some clients already do this outside of the interface: diffusion/FBS/browse/master/fbcode/servicerouter/client/common/ThriftDispatcher.h$302,607?view=highlighted 2) inefficient timers can be easily avoided: diffusion/FBS/browse/master/fbcode/thrift/lib/cpp2/async/HeaderClientChannel.h;64fb260ea4bd235ba79414a78002fd68cf0453a8$319 3) D2379210 indicates we can do a better job with this than cob timeout Reviewed By: andriigrynenko, djwatson Differential Revision: D3460792 fbshipit-source-id: a7bb6fdd90ca95b6aef8af952d7a66dd0dc260c1
-
- 29 Jun, 2016 4 commits
-
-
Eric Niebler authored
gcc-4.8 is not decaying types correctly in lambda init captures. Help it out. Fixes open source build. Summary: Trivial change gets folly::ThreadLocal building again with gcc-4.8, needed by the Open Source build. Reviewed By: chadparry, yfeldblum Differential Revision: D3498657 fbshipit-source-id: cf36f2bef7f1d03d133d16bfd063f7a2ce681822
-
Mirek Klimos authored
Summary: with the added blocks, pointer to RequestContext needs to be captured by value, not reference Differential Revision: D3499921 fbshipit-source-id: 76ff22869228fbdd7ef1651cd2814550f6abc301
-
Eric Niebler authored
Summary: 'make check' is failing since the path to OpenSSLHashTest.cpp is wrong and because ssl_test is not linked to libcrypto. Reviewed By: mhx Differential Revision: D3498207 fbshipit-source-id: 0f443d1f1b76c537d211dc148df0cd3fdfb8eead
-
Mirek Klimos authored
Summary: RequestContextScopeGuard should be preferred to RequestContext::create because it makes sure that RequestContext is cleared afterwards - need to create more examples of this in the codebase, migrating unit tests should be safe Reviewed By: interwq Differential Revision: D3489969 fbshipit-source-id: 202fec93116db3d435c108fafecad26a4ed9b603
-
- 27 Jun, 2016 2 commits
-
-
Marcus Holland-Moritz authored
Summary: In order to be consistent with integral-to-bool conversion, this change allows conversion from floating point values to bool following the same rule that is to be consistent with C(++) conventions. Also, any arithmetic value can be converted to bool without potential for undefined behaviour, so no extra checks are required. Differential Revision: D3483760 fbshipit-source-id: 024b58d348ef679079aba4d9d5277acb46aba2a1
-
Bo You authored
Summary: Right now in ##parseNumber## in ##folly/json.cpp##, when a negative number is provided, both the minus sign and the digits are stored in the variable ##integral##: https://fburl.com/362938516. This causes problem when the exact min int is provided (-9223372036854775808). Because now ##integral.size()## equals 20 (including the minus sign), which is greater than ##maxIntLen## (which is 19). We need to handle negatives separately to get the correct result. Reviewed By: yfeldblum Differential Revision: D3479054 fbshipit-source-id: 15c782962a5f5ee845a2a18f2145c7695ec2d546
-
- 26 Jun, 2016 1 commit
-
-
David Lam authored
Summary: #accept2ship Reviewed By: Orvid Differential Revision: D3486732 fbshipit-source-id: 45bfe1daa1dbd1e427fcd18e71e6b9eeb6d6b2b7
-