react-native-windows 0.85.0-preview.1 → 0.85.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Directory.Build.props +1 -1
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp +28 -46
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.h +0 -3
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +19 -13
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp +107 -0
- package/Microsoft.ReactNative/Fabric/Composition/SelectionItemAutomationEvent.h +73 -0
- package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.cpp +105 -32
- package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.h +7 -2
- package/PropertySheets/CIBuildOptimizations.props +2 -2
- package/PropertySheets/Generated/PackageVersion.g.props +2 -2
- package/PropertySheets/JSEngine.props +1 -1
- package/PropertySheets/NuGet.LockFile.props +2 -9
- package/Scripts/NuGetRestoreForceEvaluateAllSolutions.ps1 +54 -5
- package/Scripts/UpdateNightlyDependencies.ps1 +47 -0
- package/Scripts/creaternwapp.cmd +29 -9
- package/Scripts/creaternwlib.cmd +31 -15
- package/external/.clang-format +1 -0
- package/external/External.vcxitems +10 -0
- package/external/fast-float/.syncignore +10 -0
- package/external/fast-float/LICENSE-APACHE +190 -0
- package/external/fast-float/LICENSE-BOOST +23 -0
- package/external/fast-float/LICENSE-MIT +27 -0
- package/external/fast-float/README.md +545 -0
- package/external/fast-float/cgmanifest.json +15 -0
- package/external/fast-float/fast-float.vcxitems +14 -0
- package/external/fast-float/include/fast_float/ascii_number.h +588 -0
- package/external/fast-float/include/fast_float/bigint.h +638 -0
- package/external/fast-float/include/fast_float/constexpr_feature_detect.h +46 -0
- package/external/fast-float/include/fast_float/decimal_to_binary.h +212 -0
- package/external/fast-float/include/fast_float/digit_comparison.h +457 -0
- package/external/fast-float/include/fast_float/fast_float.h +59 -0
- package/external/fast-float/include/fast_float/fast_table.h +708 -0
- package/external/fast-float/include/fast_float/float_common.h +1240 -0
- package/external/fast-float/include/fast_float/parse_number.h +399 -0
- package/external/fast-float/sync-config.json +8 -0
- package/external/fmt/.syncignore +10 -0
- package/external/fmt/CONTRIBUTING.md +20 -0
- package/external/fmt/LICENSE +27 -0
- package/external/fmt/README.md +484 -0
- package/external/fmt/cgmanifest.json +15 -0
- package/external/fmt/doc/ChangeLog-old.md +3290 -0
- package/external/fmt/doc/api.md +650 -0
- package/external/fmt/doc/fmt.css +61 -0
- package/external/fmt/doc/fmt.js +4 -0
- package/external/fmt/doc/get-started.md +222 -0
- package/external/fmt/doc/index.md +151 -0
- package/external/fmt/doc/perf.svg +1 -0
- package/external/fmt/doc/python-license.txt +290 -0
- package/external/fmt/doc/syntax.md +887 -0
- package/external/fmt/fmt.vcxitems +28 -0
- package/external/fmt/include/fmt/args.h +228 -0
- package/external/fmt/include/fmt/base.h +3077 -0
- package/external/fmt/include/fmt/chrono.h +2432 -0
- package/external/fmt/include/fmt/color.h +612 -0
- package/external/fmt/include/fmt/compile.h +529 -0
- package/external/fmt/include/fmt/core.h +5 -0
- package/external/fmt/include/fmt/format-inl.h +1928 -0
- package/external/fmt/include/fmt/format.h +4427 -0
- package/external/fmt/include/fmt/os.h +439 -0
- package/external/fmt/include/fmt/ostream.h +211 -0
- package/external/fmt/include/fmt/printf.h +656 -0
- package/external/fmt/include/fmt/ranges.h +882 -0
- package/external/fmt/include/fmt/std.h +699 -0
- package/external/fmt/include/fmt/xchar.h +322 -0
- package/external/fmt/src/fmt.cc +135 -0
- package/external/fmt/src/format.cc +43 -0
- package/external/fmt/src/os.cc +403 -0
- package/external/fmt/sync-config.json +8 -0
- package/external/folly/.syncignore +60 -0
- package/external/folly/Folly.natvis +25 -0
- package/external/folly/LICENSE +200 -0
- package/external/folly/README.md +263 -0
- package/external/folly/cgmanifest.json +25 -0
- package/external/folly/folly/.clang-format +1 -0
- package/external/folly/folly/AtomicHashArray-inl.h +546 -0
- package/external/folly/folly/AtomicHashArray.h +431 -0
- package/external/folly/folly/AtomicHashMap-inl.h +653 -0
- package/external/folly/folly/AtomicHashMap.h +484 -0
- package/external/folly/folly/AtomicIntrusiveLinkedList.h +206 -0
- package/external/folly/folly/AtomicLinkedList.h +110 -0
- package/external/folly/folly/AtomicUnorderedMap.h +522 -0
- package/external/folly/folly/BUCK +1631 -0
- package/external/folly/folly/BUILD_MODE.bzl +72 -0
- package/external/folly/folly/Benchmark.cpp +986 -0
- package/external/folly/folly/Benchmark.h +680 -0
- package/external/folly/folly/BenchmarkUtil.h +47 -0
- package/external/folly/folly/Bits.h +17 -0
- package/external/folly/folly/CMakeLists.txt +110 -0
- package/external/folly/folly/CPortability.h +338 -0
- package/external/folly/folly/CancellationToken-inl.h +449 -0
- package/external/folly/folly/CancellationToken.cpp +250 -0
- package/external/folly/folly/CancellationToken.h +365 -0
- package/external/folly/folly/Chrono.h +132 -0
- package/external/folly/folly/ClockGettimeWrappers.cpp +93 -0
- package/external/folly/folly/ClockGettimeWrappers.h +29 -0
- package/external/folly/folly/ConcurrentBitSet.h +157 -0
- package/external/folly/folly/ConcurrentLazy.h +74 -0
- package/external/folly/folly/ConcurrentSkipList-inl.h +341 -0
- package/external/folly/folly/ConcurrentSkipList.h +824 -0
- package/external/folly/folly/ConstexprMath.h +978 -0
- package/external/folly/folly/ConstructorCallbackList.h +158 -0
- package/external/folly/folly/Conv.cpp +1205 -0
- package/external/folly/folly/Conv.h +2026 -0
- package/external/folly/folly/CppAttributes.h +170 -0
- package/external/folly/folly/CpuId.h +297 -0
- package/external/folly/folly/DefaultKeepAliveExecutor.h +172 -0
- package/external/folly/folly/Demangle.cpp +255 -0
- package/external/folly/folly/Demangle.h +73 -0
- package/external/folly/folly/DiscriminatedPtr.h +236 -0
- package/external/folly/folly/DynamicConverter.h +17 -0
- package/external/folly/folly/Exception.h +150 -0
- package/external/folly/folly/ExceptionString.cpp +51 -0
- package/external/folly/folly/ExceptionString.h +33 -0
- package/external/folly/folly/ExceptionWrapper-inl.h +264 -0
- package/external/folly/folly/ExceptionWrapper.cpp +37 -0
- package/external/folly/folly/ExceptionWrapper.h +377 -0
- package/external/folly/folly/Executor.cpp +111 -0
- package/external/folly/folly/Executor.h +351 -0
- package/external/folly/folly/Expected.h +1725 -0
- package/external/folly/folly/FBString.h +2888 -0
- package/external/folly/folly/FBVector.h +17 -0
- package/external/folly/folly/File.cpp +180 -0
- package/external/folly/folly/File.h +177 -0
- package/external/folly/folly/FileUtil.cpp +378 -0
- package/external/folly/folly/FileUtil.h +332 -0
- package/external/folly/folly/Fingerprint.cpp +135 -0
- package/external/folly/folly/Fingerprint.h +289 -0
- package/external/folly/folly/FixedString.h +2965 -0
- package/external/folly/folly/FollyMemcpy.cpp +30 -0
- package/external/folly/folly/FollyMemcpy.h +23 -0
- package/external/folly/folly/FollyMemset.cpp +29 -0
- package/external/folly/folly/FollyMemset.h +25 -0
- package/external/folly/folly/Format-inl.h +1152 -0
- package/external/folly/folly/Format.cpp +429 -0
- package/external/folly/folly/Format.h +463 -0
- package/external/folly/folly/FormatArg.h +285 -0
- package/external/folly/folly/FormatTraits.h +65 -0
- package/external/folly/folly/Function.h +1159 -0
- package/external/folly/folly/GLog.h +85 -0
- package/external/folly/folly/GroupVarint.cpp +153 -0
- package/external/folly/folly/GroupVarint.h +630 -0
- package/external/folly/folly/Hash.h +20 -0
- package/external/folly/folly/IPAddress.cpp +490 -0
- package/external/folly/folly/IPAddress.h +667 -0
- package/external/folly/folly/IPAddressException.h +82 -0
- package/external/folly/folly/IPAddressV4.cpp +305 -0
- package/external/folly/folly/IPAddressV4.h +495 -0
- package/external/folly/folly/IPAddressV6.cpp +541 -0
- package/external/folly/folly/IPAddressV6.h +627 -0
- package/external/folly/folly/Indestructible.h +164 -0
- package/external/folly/folly/IndexedMemPool.h +550 -0
- package/external/folly/folly/IntrusiveList.h +17 -0
- package/external/folly/folly/Lazy.h +142 -0
- package/external/folly/folly/Likely.h +76 -0
- package/external/folly/folly/MPMCPipeline.h +280 -0
- package/external/folly/folly/MPMCQueue.h +1556 -0
- package/external/folly/folly/MacAddress.cpp +188 -0
- package/external/folly/folly/MacAddress.h +260 -0
- package/external/folly/folly/MapUtil.h +17 -0
- package/external/folly/folly/Math.h +258 -0
- package/external/folly/folly/MaybeManagedPtr.h +120 -0
- package/external/folly/folly/Memory.h +900 -0
- package/external/folly/folly/MicroLock.cpp +76 -0
- package/external/folly/folly/MicroLock.h +354 -0
- package/external/folly/folly/MicroSpinLock.h +17 -0
- package/external/folly/folly/MoveWrapper.h +76 -0
- package/external/folly/folly/ObserverContainer.h +1026 -0
- package/external/folly/folly/Optional.h +743 -0
- package/external/folly/folly/Overload.h +325 -0
- package/external/folly/folly/PackedSyncPtr.h +147 -0
- package/external/folly/folly/Padded.h +464 -0
- package/external/folly/folly/Poly-inl.h +230 -0
- package/external/folly/folly/Poly.h +1095 -0
- package/external/folly/folly/PolyException.h +43 -0
- package/external/folly/folly/Portability.h +644 -0
- package/external/folly/folly/Preprocessor.h +236 -0
- package/external/folly/folly/ProducerConsumerQueue.h +182 -0
- package/external/folly/folly/RWSpinLock.h +17 -0
- package/external/folly/folly/Random-inl.h +86 -0
- package/external/folly/folly/Random.cpp +184 -0
- package/external/folly/folly/Random.h +434 -0
- package/external/folly/folly/Range.h +1772 -0
- package/external/folly/folly/Replaceable.h +636 -0
- package/external/folly/folly/ScopeGuard.cpp +29 -0
- package/external/folly/folly/ScopeGuard.h +420 -0
- package/external/folly/folly/SharedMutex.cpp +81 -0
- package/external/folly/folly/SharedMutex.h +1751 -0
- package/external/folly/folly/Singleton-inl.h +332 -0
- package/external/folly/folly/Singleton.cpp +512 -0
- package/external/folly/folly/Singleton.h +891 -0
- package/external/folly/folly/SingletonThreadLocal.cpp +53 -0
- package/external/folly/folly/SingletonThreadLocal.h +263 -0
- package/external/folly/folly/SocketAddress.cpp +786 -0
- package/external/folly/folly/SocketAddress.h +768 -0
- package/external/folly/folly/SpinLock.h +55 -0
- package/external/folly/folly/String-inl.h +668 -0
- package/external/folly/folly/String.cpp +777 -0
- package/external/folly/folly/String.h +767 -0
- package/external/folly/folly/Subprocess.cpp +1142 -0
- package/external/folly/folly/Subprocess.h +1055 -0
- package/external/folly/folly/Synchronized.h +1833 -0
- package/external/folly/folly/SynchronizedPtr.h +106 -0
- package/external/folly/folly/ThreadCachedInt.h +175 -0
- package/external/folly/folly/ThreadLocal.h +478 -0
- package/external/folly/folly/TimeoutQueue.cpp +78 -0
- package/external/folly/folly/TimeoutQueue.h +123 -0
- package/external/folly/folly/TokenBucket.h +673 -0
- package/external/folly/folly/Traits.h +1442 -0
- package/external/folly/folly/Try-inl.h +372 -0
- package/external/folly/folly/Try.cpp +23 -0
- package/external/folly/folly/Try.h +728 -0
- package/external/folly/folly/UTF8String.h +56 -0
- package/external/folly/folly/Unicode.cpp +201 -0
- package/external/folly/folly/Unicode.h +94 -0
- package/external/folly/folly/Unit.h +65 -0
- package/external/folly/folly/Uri-inl.h +101 -0
- package/external/folly/folly/Uri.cpp +190 -0
- package/external/folly/folly/Uri.h +142 -0
- package/external/folly/folly/Utility.h +932 -0
- package/external/folly/folly/VERSION +1 -0
- package/external/folly/folly/Varint.h +230 -0
- package/external/folly/folly/VirtualExecutor.h +17 -0
- package/external/folly/folly/algorithm/simd/BUCK +47 -0
- package/external/folly/folly/algorithm/simd/Contains.cpp +42 -0
- package/external/folly/folly/algorithm/simd/Contains.h +116 -0
- package/external/folly/folly/algorithm/simd/FindFixed.h +301 -0
- package/external/folly/folly/algorithm/simd/Ignore.h +52 -0
- package/external/folly/folly/algorithm/simd/Movemask.h +207 -0
- package/external/folly/folly/algorithm/simd/detail/BUCK +70 -0
- package/external/folly/folly/algorithm/simd/detail/ContainsImpl.h +91 -0
- package/external/folly/folly/algorithm/simd/detail/SimdAnyOf.h +83 -0
- package/external/folly/folly/algorithm/simd/detail/SimdForEach.h +209 -0
- package/external/folly/folly/algorithm/simd/detail/SimdPlatform.h +445 -0
- package/external/folly/folly/algorithm/simd/detail/Traits.h +125 -0
- package/external/folly/folly/algorithm/simd/detail/UnrollUtils.h +126 -0
- package/external/folly/folly/base64.h +264 -0
- package/external/folly/folly/chrono/BUCK +29 -0
- package/external/folly/folly/chrono/Clock.h +65 -0
- package/external/folly/folly/chrono/Conv.h +712 -0
- package/external/folly/folly/chrono/Hardware.h +155 -0
- package/external/folly/folly/chrono/test/BUCK +26 -0
- package/external/folly/folly/chrono/test/ClockTest.cpp +68 -0
- package/external/folly/folly/chrono/test/ConvTest.cpp +652 -0
- package/external/folly/folly/concurrency/AtomicSharedPtr.h +387 -0
- package/external/folly/folly/concurrency/BUCK +170 -0
- package/external/folly/folly/concurrency/CacheLocality.cpp +633 -0
- package/external/folly/folly/concurrency/CacheLocality.h +460 -0
- package/external/folly/folly/concurrency/ConcurrentHashMap.h +822 -0
- package/external/folly/folly/concurrency/CoreCachedSharedPtr.h +232 -0
- package/external/folly/folly/concurrency/DeadlockDetector.cpp +27 -0
- package/external/folly/folly/concurrency/DeadlockDetector.h +44 -0
- package/external/folly/folly/concurrency/DynamicBoundedQueue.h +751 -0
- package/external/folly/folly/concurrency/PriorityUnboundedQueueSet.h +207 -0
- package/external/folly/folly/concurrency/ProcessLocalUniqueId.cpp +46 -0
- package/external/folly/folly/concurrency/ProcessLocalUniqueId.h +38 -0
- package/external/folly/folly/concurrency/SingletonRelaxedCounter.h +325 -0
- package/external/folly/folly/concurrency/ThreadCachedSynchronized.h +227 -0
- package/external/folly/folly/concurrency/UnboundedQueue.h +891 -0
- package/external/folly/folly/concurrency/container/BUCK +77 -0
- package/external/folly/folly/concurrency/container/FlatCombiningPriorityQueue.h +426 -0
- package/external/folly/folly/concurrency/container/LockFreeRingBuffer.h +306 -0
- package/external/folly/folly/concurrency/container/RelaxedConcurrentPriorityQueue.h +1212 -0
- package/external/folly/folly/concurrency/container/SingleWriterFixedHashMap.h +322 -0
- package/external/folly/folly/concurrency/container/atomic_grow_array.h +564 -0
- package/external/folly/folly/concurrency/container/test/BUCK +75 -0
- package/external/folly/folly/concurrency/container/test/FlatCombiningPriorityQueueTest.cpp +570 -0
- package/external/folly/folly/concurrency/container/test/LockFreeRingBufferTest.cpp +276 -0
- package/external/folly/folly/concurrency/container/test/RelaxedConcurrentPriorityQueueTest.cpp +1570 -0
- package/external/folly/folly/concurrency/container/test/SingleWriterFixedHashMapTest.cpp +401 -0
- package/external/folly/folly/concurrency/container/test/atomic_grow_array_test.cpp +187 -0
- package/external/folly/folly/concurrency/detail/AtomicSharedPtr-detail.h +212 -0
- package/external/folly/folly/concurrency/detail/ConcurrentHashMap-detail.h +1911 -0
- package/external/folly/folly/concurrency/memory/AtomicReadMostlyMainPtr.cpp +43 -0
- package/external/folly/folly/concurrency/memory/AtomicReadMostlyMainPtr.h +190 -0
- package/external/folly/folly/concurrency/memory/BUCK +53 -0
- package/external/folly/folly/concurrency/memory/PrimaryPtr.h +338 -0
- package/external/folly/folly/concurrency/memory/ReadMostlySharedPtr.h +511 -0
- package/external/folly/folly/concurrency/memory/TLRefCount.h +228 -0
- package/external/folly/folly/concurrency/memory/test/AtomicReadMostlyMainPtrBenchmark.cpp +56 -0
- package/external/folly/folly/concurrency/memory/test/AtomicReadMostlyMainPtrTest.cpp +454 -0
- package/external/folly/folly/concurrency/memory/test/BUCK +95 -0
- package/external/folly/folly/concurrency/memory/test/PrimaryPtrTest.cpp +303 -0
- package/external/folly/folly/concurrency/memory/test/ReadMostlySharedPtrBenchmark.cpp +138 -0
- package/external/folly/folly/concurrency/memory/test/ReadMostlySharedPtrStressTest.cpp +75 -0
- package/external/folly/folly/concurrency/memory/test/ReadMostlySharedPtrTest.cpp +378 -0
- package/external/folly/folly/concurrency/memory/test/RefCountBenchmark.cpp +90 -0
- package/external/folly/folly/concurrency/memory/test/RefCountTest.cpp +168 -0
- package/external/folly/folly/concurrency/test/AtomicSharedPtrCounted.h +156 -0
- package/external/folly/folly/concurrency/test/AtomicSharedPtrPerformance.cpp +255 -0
- package/external/folly/folly/concurrency/test/AtomicSharedPtrTest.cpp +257 -0
- package/external/folly/folly/concurrency/test/BUCK +229 -0
- package/external/folly/folly/concurrency/test/CacheLocalityBenchmark.cpp +392 -0
- package/external/folly/folly/concurrency/test/CacheLocalityTest.cpp +1229 -0
- package/external/folly/folly/concurrency/test/ConcurrentHashMapBench.cpp +260 -0
- package/external/folly/folly/concurrency/test/ConcurrentHashMapTest.cpp +1242 -0
- package/external/folly/folly/concurrency/test/CoreCachedSharedPtrTest.cpp +408 -0
- package/external/folly/folly/concurrency/test/DynamicBoundedQueueTest.cpp +984 -0
- package/external/folly/folly/concurrency/test/PriorityUnboundedQueueSetTest.cpp +73 -0
- package/external/folly/folly/concurrency/test/ProcessLocalUniqueIdTest.cpp +66 -0
- package/external/folly/folly/concurrency/test/SingletonRelaxedCounterBench.cpp +101 -0
- package/external/folly/folly/concurrency/test/SingletonRelaxedCounterTest.cpp +185 -0
- package/external/folly/folly/concurrency/test/ThreadCachedSynchronizedBench.cpp +76 -0
- package/external/folly/folly/concurrency/test/ThreadCachedSynchronizedTest.cpp +93 -0
- package/external/folly/folly/concurrency/test/UnboundedQueueTest.cpp +1302 -0
- package/external/folly/folly/container/Access.h +57 -0
- package/external/folly/folly/container/Array.h +87 -0
- package/external/folly/folly/container/BUCK +353 -0
- package/external/folly/folly/container/BitIterator.h +203 -0
- package/external/folly/folly/container/Enumerate.h +162 -0
- package/external/folly/folly/container/EvictingCacheMap.h +730 -0
- package/external/folly/folly/container/F14.md +300 -0
- package/external/folly/folly/container/F14Map-fwd.h +113 -0
- package/external/folly/folly/container/F14Map.h +2108 -0
- package/external/folly/folly/container/F14Set-fwd.h +95 -0
- package/external/folly/folly/container/F14Set.h +1603 -0
- package/external/folly/folly/container/FBVector.h +1711 -0
- package/external/folly/folly/container/Foreach-inl.h +316 -0
- package/external/folly/folly/container/Foreach.h +209 -0
- package/external/folly/folly/container/HeterogeneousAccess-fwd.h +33 -0
- package/external/folly/folly/container/HeterogeneousAccess.h +171 -0
- package/external/folly/folly/container/IntrusiveHeap.h +268 -0
- package/external/folly/folly/container/IntrusiveList.h +131 -0
- package/external/folly/folly/container/Iterator.h +843 -0
- package/external/folly/folly/container/MapUtil.h +376 -0
- package/external/folly/folly/container/Merge.h +90 -0
- package/external/folly/folly/container/RegexMatchCache.cpp +521 -0
- package/external/folly/folly/container/RegexMatchCache.h +699 -0
- package/external/folly/folly/container/Reserve.h +109 -0
- package/external/folly/folly/container/SparseByteSet.h +123 -0
- package/external/folly/folly/container/View.h +81 -0
- package/external/folly/folly/container/WeightedEvictingCacheMap.h +651 -0
- package/external/folly/folly/container/detail/BUCK +115 -0
- package/external/folly/folly/container/detail/BitIteratorDetail.h +87 -0
- package/external/folly/folly/container/detail/F14Defaults.h +34 -0
- package/external/folly/folly/container/detail/F14IntrinsicsAvailability.h +67 -0
- package/external/folly/folly/container/detail/F14MapFallback.h +717 -0
- package/external/folly/folly/container/detail/F14Mask.h +235 -0
- package/external/folly/folly/container/detail/F14Policy.h +1523 -0
- package/external/folly/folly/container/detail/F14SetFallback.h +528 -0
- package/external/folly/folly/container/detail/F14Table.cpp +71 -0
- package/external/folly/folly/container/detail/F14Table.h +2680 -0
- package/external/folly/folly/container/detail/Util.h +303 -0
- package/external/folly/folly/container/detail/tape_detail.h +135 -0
- package/external/folly/folly/container/detail/test/BUCK +14 -0
- package/external/folly/folly/container/detail/test/F14DetailTest.cpp +47 -0
- package/external/folly/folly/container/heap_vector_types.h +1683 -0
- package/external/folly/folly/container/range_traits.h +81 -0
- package/external/folly/folly/container/small_vector.h +1476 -0
- package/external/folly/folly/container/sorted_vector_types.h +1652 -0
- package/external/folly/folly/container/span.h +408 -0
- package/external/folly/folly/container/tape.h +608 -0
- package/external/folly/folly/container/test/.clang-tidy +12 -0
- package/external/folly/folly/container/test/AccessTest.cpp +138 -0
- package/external/folly/folly/container/test/ArrayTest.cpp +84 -0
- package/external/folly/folly/container/test/BUCK +568 -0
- package/external/folly/folly/container/test/BitIteratorBench.cpp +112 -0
- package/external/folly/folly/container/test/BitIteratorTest.cpp +109 -0
- package/external/folly/folly/container/test/EnumerateTest.cpp +294 -0
- package/external/folly/folly/container/test/EvictingCacheMapBench.cpp +80 -0
- package/external/folly/folly/container/test/EvictingCacheMapTest.cpp +842 -0
- package/external/folly/folly/container/test/F14AsanSupportTest.cpp +143 -0
- package/external/folly/folly/container/test/F14FwdTest.cpp +37 -0
- package/external/folly/folly/container/test/F14InterprocessTest.cpp +404 -0
- package/external/folly/folly/container/test/F14MapTest.cpp +2543 -0
- package/external/folly/folly/container/test/F14PolicyTest.cpp +49 -0
- package/external/folly/folly/container/test/F14SetTest.cpp +1738 -0
- package/external/folly/folly/container/test/F14SmallOverheads.cpp +215 -0
- package/external/folly/folly/container/test/F14TestUtil.h +117 -0
- package/external/folly/folly/container/test/FBVectorBenchmark.cpp +380 -0
- package/external/folly/folly/container/test/FBVectorBenchmarks.cpp.h +100 -0
- package/external/folly/folly/container/test/FBVectorTest.cpp +326 -0
- package/external/folly/folly/container/test/FBVectorTests.cpp.h +304 -0
- package/external/folly/folly/container/test/ForeachBenchmark.cpp +388 -0
- package/external/folly/folly/container/test/ForeachTest.cpp +338 -0
- package/external/folly/folly/container/test/HashMapsBench.cpp +458 -0
- package/external/folly/folly/container/test/HeterogeneousAccessTest.cpp +242 -0
- package/external/folly/folly/container/test/IntrusiveHeapTest.cpp +262 -0
- package/external/folly/folly/container/test/IteratorTest.cpp +989 -0
- package/external/folly/folly/container/test/MapUtilTest.cpp +365 -0
- package/external/folly/folly/container/test/MergeTest.cpp +66 -0
- package/external/folly/folly/container/test/RegexMatchCacheTest.cpp +634 -0
- package/external/folly/folly/container/test/ReserveTest.cpp +173 -0
- package/external/folly/folly/container/test/SparseByteSetBenchmark.cpp +153 -0
- package/external/folly/folly/container/test/SparseByteSetTest.cpp +117 -0
- package/external/folly/folly/container/test/TrackingTypes.h +584 -0
- package/external/folly/folly/container/test/UtilTest.cpp +609 -0
- package/external/folly/folly/container/test/WeightedEvictingCacheMapTest.cpp +800 -0
- package/external/folly/folly/container/test/heap_vector_types_test.cpp +1774 -0
- package/external/folly/folly/container/test/range_traits_test.cpp +59 -0
- package/external/folly/folly/container/test/small_vector_test.cpp +1571 -0
- package/external/folly/folly/container/test/sorted_vector_test.cpp +1589 -0
- package/external/folly/folly/container/test/span_test.cpp +520 -0
- package/external/folly/folly/container/test/tape_bench.cpp +200 -0
- package/external/folly/folly/container/test/tape_test.cpp +590 -0
- package/external/folly/folly/defs.bzl +238 -0
- package/external/folly/folly/detail/AsyncTrace.cpp +36 -0
- package/external/folly/folly/detail/AsyncTrace.h +44 -0
- package/external/folly/folly/detail/AtomicHashUtils.h +42 -0
- package/external/folly/folly/detail/AtomicUnorderedMapUtils.h +80 -0
- package/external/folly/folly/detail/BUCK +406 -0
- package/external/folly/folly/detail/DiscriminatedPtrDetail.h +172 -0
- package/external/folly/folly/detail/FileUtilDetail.cpp +63 -0
- package/external/folly/folly/detail/FileUtilDetail.h +85 -0
- package/external/folly/folly/detail/FileUtilVectorDetail.h +81 -0
- package/external/folly/folly/detail/FingerprintPolynomial.h +132 -0
- package/external/folly/folly/detail/Futex-inl.h +123 -0
- package/external/folly/folly/detail/Futex.cpp +273 -0
- package/external/folly/folly/detail/Futex.h +109 -0
- package/external/folly/folly/detail/GroupVarintDetail.h +101 -0
- package/external/folly/folly/detail/IPAddress.cpp +37 -0
- package/external/folly/folly/detail/IPAddress.h +57 -0
- package/external/folly/folly/detail/IPAddressSource.h +278 -0
- package/external/folly/folly/detail/Iterators.h +156 -0
- package/external/folly/folly/detail/MPMCPipelineDetail.h +122 -0
- package/external/folly/folly/detail/MemoryIdler.cpp +233 -0
- package/external/folly/folly/detail/MemoryIdler.h +216 -0
- package/external/folly/folly/detail/PerfScoped.cpp +112 -0
- package/external/folly/folly/detail/PerfScoped.h +70 -0
- package/external/folly/folly/detail/PolyDetail.h +921 -0
- package/external/folly/folly/detail/RangeCommon.cpp +55 -0
- package/external/folly/folly/detail/RangeCommon.h +93 -0
- package/external/folly/folly/detail/RangeSse42.cpp +198 -0
- package/external/folly/folly/detail/RangeSse42.h +30 -0
- package/external/folly/folly/detail/SimpleSimdStringUtils.cpp +31 -0
- package/external/folly/folly/detail/SimpleSimdStringUtils.h +27 -0
- package/external/folly/folly/detail/SimpleSimdStringUtilsImpl.h +63 -0
- package/external/folly/folly/detail/Singleton.h +34 -0
- package/external/folly/folly/detail/SlowFingerprint.h +90 -0
- package/external/folly/folly/detail/SocketFastOpen.cpp +175 -0
- package/external/folly/folly/detail/SocketFastOpen.h +89 -0
- package/external/folly/folly/detail/SplitStringSimd.cpp +84 -0
- package/external/folly/folly/detail/SplitStringSimd.h +151 -0
- package/external/folly/folly/detail/SplitStringSimdImpl.h +149 -0
- package/external/folly/folly/detail/Sse.cpp +35 -0
- package/external/folly/folly/detail/Sse.h +45 -0
- package/external/folly/folly/detail/StaticSingletonManager.cpp +119 -0
- package/external/folly/folly/detail/StaticSingletonManager.h +298 -0
- package/external/folly/folly/detail/ThreadLocalDetail.cpp +492 -0
- package/external/folly/folly/detail/ThreadLocalDetail.h +800 -0
- package/external/folly/folly/detail/TrapOnAvx512.cpp +41 -0
- package/external/folly/folly/detail/TrapOnAvx512.h +21 -0
- package/external/folly/folly/detail/TurnSequencer.h +295 -0
- package/external/folly/folly/detail/TypeList.h +551 -0
- package/external/folly/folly/detail/UniqueInstance.cpp +136 -0
- package/external/folly/folly/detail/UniqueInstance.h +68 -0
- package/external/folly/folly/detail/base64_detail/BUCK +102 -0
- package/external/folly/folly/detail/base64_detail/Base64Api.cpp +40 -0
- package/external/folly/folly/detail/base64_detail/Base64Api.h +101 -0
- package/external/folly/folly/detail/base64_detail/Base64Common.h +80 -0
- package/external/folly/folly/detail/base64_detail/Base64Constants.h +79 -0
- package/external/folly/folly/detail/base64_detail/Base64HiddenConstants.h +129 -0
- package/external/folly/folly/detail/base64_detail/Base64SWAR.cpp +161 -0
- package/external/folly/folly/detail/base64_detail/Base64SWAR.h +32 -0
- package/external/folly/folly/detail/base64_detail/Base64Scalar.h +262 -0
- package/external/folly/folly/detail/base64_detail/Base64Simd.h +102 -0
- package/external/folly/folly/detail/base64_detail/Base64_SSE4_2.cpp +42 -0
- package/external/folly/folly/detail/base64_detail/Base64_SSE4_2.h +33 -0
- package/external/folly/folly/detail/base64_detail/Base64_SSE4_2_Platform.h +167 -0
- package/external/folly/folly/detail/base64_detail/README.md +392 -0
- package/external/folly/folly/detail/base64_detail/tests/BUCK +36 -0
- package/external/folly/folly/detail/base64_detail/tests/Base64AgainstScalarTest.cpp +141 -0
- package/external/folly/folly/detail/base64_detail/tests/Base64PlatformTest.cpp +273 -0
- package/external/folly/folly/detail/base64_detail/tests/Base64SpecialCasesTest.cpp +555 -0
- package/external/folly/folly/detail/test/AsyncTraceTest.cpp +43 -0
- package/external/folly/folly/detail/test/BUCK +118 -0
- package/external/folly/folly/detail/test/FileUtilDetailTest.cpp +56 -0
- package/external/folly/folly/detail/test/PerfScopedTest.cpp +107 -0
- package/external/folly/folly/detail/test/SimpleSimdStringUtilsTest.cpp +92 -0
- package/external/folly/folly/detail/test/SplitStringSimdTest.cpp +242 -0
- package/external/folly/folly/detail/test/StaticSingletonManagerTest.cpp +121 -0
- package/external/folly/folly/detail/test/ThreadLocalBenchmark.cpp +116 -0
- package/external/folly/folly/detail/test/ThreadLocalDetailTest.cpp +194 -0
- package/external/folly/folly/detail/test/TrapOnAvx512TestNegative.cpp +29 -0
- package/external/folly/folly/detail/test/UniqueInstanceTest.cpp +60 -0
- package/external/folly/folly/detail/thread_local_globals.cpp +69 -0
- package/external/folly/folly/detail/thread_local_globals.h +36 -0
- package/external/folly/folly/docs/AtomicHashMap.md +134 -0
- package/external/folly/folly/docs/Benchmark.md +310 -0
- package/external/folly/folly/docs/Conv.md +291 -0
- package/external/folly/folly/docs/Dynamic.md +220 -0
- package/external/folly/folly/docs/DynamicConverter.md +71 -0
- package/external/folly/folly/docs/Executors.md +63 -0
- package/external/folly/folly/docs/FBString.md +46 -0
- package/external/folly/folly/docs/FBVector.md +200 -0
- package/external/folly/folly/docs/Fbvector--graphical_solutions.png +0 -0
- package/external/folly/folly/docs/Format.md +177 -0
- package/external/folly/folly/docs/Function.md +92 -0
- package/external/folly/folly/docs/Futures.md +263 -0
- package/external/folly/folly/docs/GroupVarint.md +46 -0
- package/external/folly/folly/docs/Histogram.md +104 -0
- package/external/folly/folly/docs/MapUtils.md +80 -0
- package/external/folly/folly/docs/Overview.md +263 -0
- package/external/folly/folly/docs/PackedSyncPtr.md +77 -0
- package/external/folly/folly/docs/Poly.md +500 -0
- package/external/folly/folly/docs/ProducerConsumerQueue.md +82 -0
- package/external/folly/folly/docs/Rcu.md +218 -0
- package/external/folly/folly/docs/SmallLocks.md +24 -0
- package/external/folly/folly/docs/Synchronized.md +793 -0
- package/external/folly/folly/docs/ThreadCachedInt.md +98 -0
- package/external/folly/folly/docs/ThreadLocal.md +105 -0
- package/external/folly/folly/docs/Traits.md +161 -0
- package/external/folly/folly/docs/small_vector.md +64 -0
- package/external/folly/folly/docs/style.css +23 -0
- package/external/folly/folly/dynamic-inl.h +17 -0
- package/external/folly/folly/dynamic.h +17 -0
- package/external/folly/folly/folly_extended_library.bzl +28 -0
- package/external/folly/folly/functional/ApplyTuple.h +204 -0
- package/external/folly/folly/functional/BUCK +57 -0
- package/external/folly/folly/functional/Invoke.h +880 -0
- package/external/folly/folly/functional/Partial.h +130 -0
- package/external/folly/folly/functional/protocol.h +203 -0
- package/external/folly/folly/functional/test/ApplyTupleTest.cpp +549 -0
- package/external/folly/folly/functional/test/BUCK +57 -0
- package/external/folly/folly/functional/test/InvokeTest.cpp +483 -0
- package/external/folly/folly/functional/test/PartialTest.cpp +141 -0
- package/external/folly/folly/functional/test/protocol_test.cpp +177 -0
- package/external/folly/folly/functional/test/traits_test.cpp +551 -0
- package/external/folly/folly/functional/traits.h +675 -0
- package/external/folly/folly/hash/BUCK +86 -0
- package/external/folly/folly/hash/Checksum.cpp +275 -0
- package/external/folly/folly/hash/Checksum.h +94 -0
- package/external/folly/folly/hash/FarmHash.h +46 -0
- package/external/folly/folly/hash/Hash.h +1045 -0
- package/external/folly/folly/hash/MurmurHash.h +86 -0
- package/external/folly/folly/hash/SpookyHashV1.cpp +391 -0
- package/external/folly/folly/hash/SpookyHashV1.h +307 -0
- package/external/folly/folly/hash/SpookyHashV2.cpp +392 -0
- package/external/folly/folly/hash/SpookyHashV2.h +339 -0
- package/external/folly/folly/hash/detail/BUCK +26 -0
- package/external/folly/folly/hash/detail/ChecksumDetail.cpp +296 -0
- package/external/folly/folly/hash/detail/ChecksumDetail.h +137 -0
- package/external/folly/folly/hash/detail/Crc32CombineDetail.cpp +191 -0
- package/external/folly/folly/hash/detail/Crc32cDetail.cpp +303 -0
- package/external/folly/folly/hash/test/BUCK +132 -0
- package/external/folly/folly/hash/test/ChecksumBenchmark.cpp +91 -0
- package/external/folly/folly/hash/test/ChecksumTest.cpp +587 -0
- package/external/folly/folly/hash/test/FarmHashTest.cpp +41 -0
- package/external/folly/folly/hash/test/HashBenchmark.cpp +238 -0
- package/external/folly/folly/hash/test/HashTest.cpp +997 -0
- package/external/folly/folly/hash/test/MurmurHashTest.cpp +76 -0
- package/external/folly/folly/hash/test/SpookyHashV1Test.cpp +559 -0
- package/external/folly/folly/hash/test/SpookyHashV2Test.cpp +549 -0
- package/external/folly/folly/hash/test/traits_test.cpp +69 -0
- package/external/folly/folly/hash/traits.h +115 -0
- package/external/folly/folly/json/BUCK +155 -0
- package/external/folly/folly/json/DynamicConverter.h +464 -0
- package/external/folly/folly/json/DynamicParser-inl.h +316 -0
- package/external/folly/folly/json/DynamicParser.cpp +198 -0
- package/external/folly/folly/json/DynamicParser.h +394 -0
- package/external/folly/folly/json/JSONSchema.cpp +1030 -0
- package/external/folly/folly/json/JSONSchema.h +73 -0
- package/external/folly/folly/json/JsonMockUtil.h +73 -0
- package/external/folly/folly/json/JsonTestUtil.cpp +167 -0
- package/external/folly/folly/json/JsonTestUtil.h +88 -0
- package/external/folly/folly/json/bser/BUCK +24 -0
- package/external/folly/folly/json/bser/Bser.h +107 -0
- package/external/folly/folly/json/bser/Dump.cpp +253 -0
- package/external/folly/folly/json/bser/Load.cpp +246 -0
- package/external/folly/folly/json/bser/test/BUCK +14 -0
- package/external/folly/folly/json/bser/test/BserTest.cpp +149 -0
- package/external/folly/folly/json/dynamic-inl.h +1438 -0
- package/external/folly/folly/json/dynamic.cpp +552 -0
- package/external/folly/folly/json/dynamic.h +1346 -0
- package/external/folly/folly/json/json.cpp +1118 -0
- package/external/folly/folly/json/json.h +238 -0
- package/external/folly/folly/json/json_patch.cpp +325 -0
- package/external/folly/folly/json/json_patch.h +126 -0
- package/external/folly/folly/json/json_pointer.cpp +114 -0
- package/external/folly/folly/json/json_pointer.h +87 -0
- package/external/folly/folly/json/test/BUCK +147 -0
- package/external/folly/folly/json/test/DynamicBenchmark.cpp +146 -0
- package/external/folly/folly/json/test/DynamicConverterTest.cpp +518 -0
- package/external/folly/folly/json/test/DynamicOtherTest.cpp +344 -0
- package/external/folly/folly/json/test/DynamicParserTest.cpp +443 -0
- package/external/folly/folly/json/test/DynamicTest.cpp +1647 -0
- package/external/folly/folly/json/test/JSONSchemaTest.cpp +450 -0
- package/external/folly/folly/json/test/JsonBenchmark.cpp +264 -0
- package/external/folly/folly/json/test/JsonOtherTest.cpp +51 -0
- package/external/folly/folly/json/test/JsonTest.cpp +1153 -0
- package/external/folly/folly/json/test/JsonTestUtilTest.cpp +97 -0
- package/external/folly/folly/json/test/json_patch_test.cpp +361 -0
- package/external/folly/folly/json/test/json_pointer_test.cpp +58 -0
- package/external/folly/folly/json/tool/BUCK +13 -0
- package/external/folly/folly/json/tool/JSONSchemaTester.cpp +58 -0
- package/external/folly/folly/json.h +17 -0
- package/external/folly/folly/json_patch.h +17 -0
- package/external/folly/folly/json_pointer.h +17 -0
- package/external/folly/folly/lang/Access.h +29 -0
- package/external/folly/folly/lang/Align.h +240 -0
- package/external/folly/folly/lang/Aligned.h +92 -0
- package/external/folly/folly/lang/Assume.h +82 -0
- package/external/folly/folly/lang/BUCK +287 -0
- package/external/folly/folly/lang/Badge.h +108 -0
- package/external/folly/folly/lang/Bits.h +570 -0
- package/external/folly/folly/lang/BitsClass.h +312 -0
- package/external/folly/folly/lang/Builtin.h +74 -0
- package/external/folly/folly/lang/CArray.h +34 -0
- package/external/folly/folly/lang/CString.cpp +86 -0
- package/external/folly/folly/lang/CString.h +55 -0
- package/external/folly/folly/lang/Cast.h +51 -0
- package/external/folly/folly/lang/CheckedMath.h +253 -0
- package/external/folly/folly/lang/CustomizationPoint.h +58 -0
- package/external/folly/folly/lang/Exception.cpp +822 -0
- package/external/folly/folly/lang/Exception.h +716 -0
- package/external/folly/folly/lang/Extern.h +55 -0
- package/external/folly/folly/lang/Hint-inl.h +144 -0
- package/external/folly/folly/lang/Hint.h +238 -0
- package/external/folly/folly/lang/Keep.h +98 -0
- package/external/folly/folly/lang/New.h +124 -0
- package/external/folly/folly/lang/Ordering.h +140 -0
- package/external/folly/folly/lang/Pretty.h +159 -0
- package/external/folly/folly/lang/PropagateConst.h +413 -0
- package/external/folly/folly/lang/RValueReferenceWrapper.h +152 -0
- package/external/folly/folly/lang/SafeAssert.cpp +589 -0
- package/external/folly/folly/lang/SafeAssert.h +188 -0
- package/external/folly/folly/lang/StaticConst.h +33 -0
- package/external/folly/folly/lang/Thunk.h +100 -0
- package/external/folly/folly/lang/ToAscii.cpp +348 -0
- package/external/folly/folly/lang/ToAscii.h +182 -0
- package/external/folly/folly/lang/TypeInfo.h +58 -0
- package/external/folly/folly/lang/UncaughtExceptions.cpp +17 -0
- package/external/folly/folly/lang/UncaughtExceptions.h +19 -0
- package/external/folly/folly/lang/test/AlignTest.cpp +87 -0
- package/external/folly/folly/lang/test/AlignedTest.cpp +130 -0
- package/external/folly/folly/lang/test/BUCK +258 -0
- package/external/folly/folly/lang/test/BadgeTest.cpp +89 -0
- package/external/folly/folly/lang/test/BitsBenchmark.cpp +164 -0
- package/external/folly/folly/lang/test/BitsClassBenchmark.cpp +122 -0
- package/external/folly/folly/lang/test/BitsClassTest.cpp +379 -0
- package/external/folly/folly/lang/test/BitsTest.cpp +577 -0
- package/external/folly/folly/lang/test/CStringTest.cpp +60 -0
- package/external/folly/folly/lang/test/CastTest.cpp +47 -0
- package/external/folly/folly/lang/test/CheckedMathTest.cpp +394 -0
- package/external/folly/folly/lang/test/ExceptionBench.cpp +427 -0
- package/external/folly/folly/lang/test/ExceptionTest.cpp +413 -0
- package/external/folly/folly/lang/test/ExternTest.cpp +39 -0
- package/external/folly/folly/lang/test/HintTest.cpp +100 -0
- package/external/folly/folly/lang/test/NewTest.cpp +38 -0
- package/external/folly/folly/lang/test/OrderingTest.cpp +105 -0
- package/external/folly/folly/lang/test/PrettyTest.cpp +44 -0
- package/external/folly/folly/lang/test/PropagateConstTest.cpp +356 -0
- package/external/folly/folly/lang/test/RValueReferenceWrapperTest.cpp +85 -0
- package/external/folly/folly/lang/test/SafeAssertTest.cpp +75 -0
- package/external/folly/folly/lang/test/ThunkTest.cpp +105 -0
- package/external/folly/folly/lang/test/ToAsciiBench.cpp +466 -0
- package/external/folly/folly/lang/test/ToAsciiTest.cpp +266 -0
- package/external/folly/folly/lang/test/TypeInfoTest.cpp +56 -0
- package/external/folly/folly/memcpy.S +292 -0
- package/external/folly/folly/memcpy_select_aarch64.cpp +145 -0
- package/external/folly/folly/memory/Arena-inl.h +83 -0
- package/external/folly/folly/memory/Arena.h +325 -0
- package/external/folly/folly/memory/BUCK +191 -0
- package/external/folly/folly/memory/JemallocHugePageAllocator.cpp +449 -0
- package/external/folly/folly/memory/JemallocHugePageAllocator.h +105 -0
- package/external/folly/folly/memory/JemallocHugePageAllocatorTest.cpp +341 -0
- package/external/folly/folly/memory/JemallocNodumpAllocator.cpp +176 -0
- package/external/folly/folly/memory/JemallocNodumpAllocator.h +119 -0
- package/external/folly/folly/memory/JemallocNodumpAllocatorTest.cpp +61 -0
- package/external/folly/folly/memory/MallctlHelper.cpp +37 -0
- package/external/folly/folly/memory/MallctlHelper.h +167 -0
- package/external/folly/folly/memory/Malloc.h +551 -0
- package/external/folly/folly/memory/MemoryResource.h +57 -0
- package/external/folly/folly/memory/ReentrantAllocator.cpp +162 -0
- package/external/folly/folly/memory/ReentrantAllocator.h +261 -0
- package/external/folly/folly/memory/SanitizeAddress.cpp +75 -0
- package/external/folly/folly/memory/SanitizeAddress.h +117 -0
- package/external/folly/folly/memory/SanitizeLeak.cpp +119 -0
- package/external/folly/folly/memory/SanitizeLeak.h +108 -0
- package/external/folly/folly/memory/ThreadCachedArena.cpp +53 -0
- package/external/folly/folly/memory/ThreadCachedArena.h +90 -0
- package/external/folly/folly/memory/UninitializedMemoryHacks.h +426 -0
- package/external/folly/folly/memory/detail/BUCK +10 -0
- package/external/folly/folly/memory/detail/MallocImpl.cpp +52 -0
- package/external/folly/folly/memory/detail/MallocImpl.h +97 -0
- package/external/folly/folly/memory/not_null-inl.h +522 -0
- package/external/folly/folly/memory/not_null.h +449 -0
- package/external/folly/folly/memory/test/ArenaTest.cpp +354 -0
- package/external/folly/folly/memory/test/BUCK +146 -0
- package/external/folly/folly/memory/test/MallctlHelperTest.cpp +169 -0
- package/external/folly/folly/memory/test/MallocBenchmark.cpp +91 -0
- package/external/folly/folly/memory/test/MallocTest.cpp +78 -0
- package/external/folly/folly/memory/test/MemoryResourceTest.cpp +31 -0
- package/external/folly/folly/memory/test/ReentrantAllocatorTest.cpp +144 -0
- package/external/folly/folly/memory/test/SanitizeAddressTest.cpp +67 -0
- package/external/folly/folly/memory/test/SanitizeLeakTest.cpp +139 -0
- package/external/folly/folly/memory/test/ThreadCachedArenaTest.cpp +276 -0
- package/external/folly/folly/memory/test/UninitializedMemoryHacksODR.cpp +21 -0
- package/external/folly/folly/memory/test/UninitializedMemoryHacksTest.cpp +327 -0
- package/external/folly/folly/memory/test/not_null_test.cpp +608 -0
- package/external/folly/folly/memset.S +245 -0
- package/external/folly/folly/memset_select_aarch64.cpp +72 -0
- package/external/folly/folly/portability/Asm.h +50 -0
- package/external/folly/folly/portability/Atomic.h +31 -0
- package/external/folly/folly/portability/BUCK +456 -0
- package/external/folly/folly/portability/Builtins.cpp +31 -0
- package/external/folly/folly/portability/Builtins.h +161 -0
- package/external/folly/folly/portability/Config.h +43 -0
- package/external/folly/folly/portability/Constexpr.h +145 -0
- package/external/folly/folly/portability/Dirent.cpp +140 -0
- package/external/folly/folly/portability/Dirent.h +41 -0
- package/external/folly/folly/portability/Event.h +44 -0
- package/external/folly/folly/portability/Fcntl.cpp +120 -0
- package/external/folly/folly/portability/Fcntl.h +67 -0
- package/external/folly/folly/portability/Filesystem.cpp +67 -0
- package/external/folly/folly/portability/Filesystem.h +114 -0
- package/external/folly/folly/portability/FmtCompile.h +40 -0
- package/external/folly/folly/portability/GFlags.h +139 -0
- package/external/folly/folly/portability/GMock.h +35 -0
- package/external/folly/folly/portability/GTest.h +35 -0
- package/external/folly/folly/portability/IOVec.h +34 -0
- package/external/folly/folly/portability/Libgen.cpp +59 -0
- package/external/folly/folly/portability/Libgen.h +29 -0
- package/external/folly/folly/portability/Libunwind.h +21 -0
- package/external/folly/folly/portability/Malloc.cpp +31 -0
- package/external/folly/folly/portability/Malloc.h +53 -0
- package/external/folly/folly/portability/Math.h +90 -0
- package/external/folly/folly/portability/Memory.h +26 -0
- package/external/folly/folly/portability/OpenSSL.cpp +17 -0
- package/external/folly/folly/portability/OpenSSL.h +102 -0
- package/external/folly/folly/portability/PThread.cpp +697 -0
- package/external/folly/folly/portability/PThread.h +148 -0
- package/external/folly/folly/portability/README.md +21 -0
- package/external/folly/folly/portability/Sched.cpp +41 -0
- package/external/folly/folly/portability/Sched.h +45 -0
- package/external/folly/folly/portability/Sockets.cpp +245 -0
- package/external/folly/folly/portability/Sockets.h +155 -0
- package/external/folly/folly/portability/SourceLocation.h +49 -0
- package/external/folly/folly/portability/Stdio.cpp +77 -0
- package/external/folly/folly/portability/Stdio.h +32 -0
- package/external/folly/folly/portability/Stdlib.cpp +172 -0
- package/external/folly/folly/portability/Stdlib.h +64 -0
- package/external/folly/folly/portability/String.cpp +53 -0
- package/external/folly/folly/portability/String.h +39 -0
- package/external/folly/folly/portability/SysFile.cpp +46 -0
- package/external/folly/folly/portability/SysFile.h +27 -0
- package/external/folly/folly/portability/SysMembarrier.cpp +104 -0
- package/external/folly/folly/portability/SysMembarrier.h +26 -0
- package/external/folly/folly/portability/SysMman.cpp +242 -0
- package/external/folly/folly/portability/SysMman.h +68 -0
- package/external/folly/folly/portability/SysResource.cpp +108 -0
- package/external/folly/folly/portability/SysResource.h +71 -0
- package/external/folly/folly/portability/SysStat.cpp +66 -0
- package/external/folly/folly/portability/SysStat.h +52 -0
- package/external/folly/folly/portability/SysSyscall.h +73 -0
- package/external/folly/folly/portability/SysTime.cpp +62 -0
- package/external/folly/folly/portability/SysTime.h +50 -0
- package/external/folly/folly/portability/SysTypes.h +44 -0
- package/external/folly/folly/portability/SysUio.cpp +179 -0
- package/external/folly/folly/portability/SysUio.h +51 -0
- package/external/folly/folly/portability/Syslog.h +39 -0
- package/external/folly/folly/portability/Time.cpp +357 -0
- package/external/folly/folly/portability/Time.h +74 -0
- package/external/folly/folly/portability/Unistd.cpp +33 -0
- package/external/folly/folly/portability/Unistd.h +111 -0
- package/external/folly/folly/portability/Windows.h +108 -0
- package/external/folly/folly/portability/openat2.c +30 -0
- package/external/folly/folly/portability/openat2.h +39 -0
- package/external/folly/folly/portability/test/BUCK +59 -0
- package/external/folly/folly/portability/test/ConstexprTest.cpp +102 -0
- package/external/folly/folly/portability/test/FilesystemTest.cpp +35 -0
- package/external/folly/folly/portability/test/LibgenTest.cpp +35 -0
- package/external/folly/folly/portability/test/OpenSSLPortabilityTest.cpp +108 -0
- package/external/folly/folly/portability/test/PThreadTest.cpp +80 -0
- package/external/folly/folly/portability/test/TimeTest.cpp +90 -0
- package/external/folly/folly/small_vector.h +17 -0
- package/external/folly/folly/somerge_defs.bzl +399 -0
- package/external/folly/folly/sorted_vector_types.h +17 -0
- package/external/folly/folly/stop_watch.h +317 -0
- package/external/folly/folly/synchronization/AsymmetricThreadFence.cpp +91 -0
- package/external/folly/folly/synchronization/AsymmetricThreadFence.h +60 -0
- package/external/folly/folly/synchronization/AtomicNotification-inl.h +146 -0
- package/external/folly/folly/synchronization/AtomicNotification.cpp +34 -0
- package/external/folly/folly/synchronization/AtomicNotification.h +117 -0
- package/external/folly/folly/synchronization/AtomicRef.h +181 -0
- package/external/folly/folly/synchronization/AtomicStruct.h +150 -0
- package/external/folly/folly/synchronization/AtomicUtil-inl.h +482 -0
- package/external/folly/folly/synchronization/AtomicUtil.h +179 -0
- package/external/folly/folly/synchronization/BUCK +418 -0
- package/external/folly/folly/synchronization/Baton.h +419 -0
- package/external/folly/folly/synchronization/CallOnce.h +263 -0
- package/external/folly/folly/synchronization/DelayedInit.h +179 -0
- package/external/folly/folly/synchronization/DistributedMutex-inl.h +1744 -0
- package/external/folly/folly/synchronization/DistributedMutex.cpp +27 -0
- package/external/folly/folly/synchronization/DistributedMutex.h +342 -0
- package/external/folly/folly/synchronization/EventCount.h +200 -0
- package/external/folly/folly/synchronization/FlatCombining.h +629 -0
- package/external/folly/folly/synchronization/Hazptr-fwd.h +217 -0
- package/external/folly/folly/synchronization/Hazptr.cpp +36 -0
- package/external/folly/folly/synchronization/Hazptr.h +209 -0
- package/external/folly/folly/synchronization/HazptrDomain.cpp +68 -0
- package/external/folly/folly/synchronization/HazptrDomain.h +832 -0
- package/external/folly/folly/synchronization/HazptrHolder.h +431 -0
- package/external/folly/folly/synchronization/HazptrObj.h +533 -0
- package/external/folly/folly/synchronization/HazptrObjLinked.h +315 -0
- package/external/folly/folly/synchronization/HazptrRec.h +68 -0
- package/external/folly/folly/synchronization/HazptrThrLocal.h +180 -0
- package/external/folly/folly/synchronization/HazptrThreadPoolExecutor.cpp +46 -0
- package/external/folly/folly/synchronization/HazptrThreadPoolExecutor.h +25 -0
- package/external/folly/folly/synchronization/Latch.h +160 -0
- package/external/folly/folly/synchronization/LifoSem.h +767 -0
- package/external/folly/folly/synchronization/Lock.h +887 -0
- package/external/folly/folly/synchronization/MicroSpinLock.h +154 -0
- package/external/folly/folly/synchronization/NativeSemaphore.h +187 -0
- package/external/folly/folly/synchronization/ParkingLot.cpp +37 -0
- package/external/folly/folly/synchronization/ParkingLot.h +330 -0
- package/external/folly/folly/synchronization/PicoSpinLock.h +167 -0
- package/external/folly/folly/synchronization/RWSpinLock.h +549 -0
- package/external/folly/folly/synchronization/Rcu.cpp +26 -0
- package/external/folly/folly/synchronization/Rcu.h +553 -0
- package/external/folly/folly/synchronization/RelaxedAtomic.h +336 -0
- package/external/folly/folly/synchronization/SanitizeThread.cpp +141 -0
- package/external/folly/folly/synchronization/SanitizeThread.h +166 -0
- package/external/folly/folly/synchronization/SaturatingSemaphore.h +324 -0
- package/external/folly/folly/synchronization/SmallLocks.h +36 -0
- package/external/folly/folly/synchronization/ThrottledLifoSem.h +362 -0
- package/external/folly/folly/synchronization/WaitOptions.cpp +25 -0
- package/external/folly/folly/synchronization/WaitOptions.h +75 -0
- package/external/folly/folly/synchronization/detail/AtomicUtils.h +59 -0
- package/external/folly/folly/synchronization/detail/BUCK +104 -0
- package/external/folly/folly/synchronization/detail/Hardware.cpp +192 -0
- package/external/folly/folly/synchronization/detail/Hardware.h +75 -0
- package/external/folly/folly/synchronization/detail/HazptrUtils.h +339 -0
- package/external/folly/folly/synchronization/detail/InlineFunctionRef.h +229 -0
- package/external/folly/folly/synchronization/detail/Sleeper.cpp +27 -0
- package/external/folly/folly/synchronization/detail/Sleeper.h +62 -0
- package/external/folly/folly/synchronization/detail/Spin.h +96 -0
- package/external/folly/folly/synchronization/detail/ThreadCachedLists.h +174 -0
- package/external/folly/folly/synchronization/detail/ThreadCachedReaders.h +189 -0
- package/external/folly/folly/synchronization/detail/ThreadCachedTag.h +26 -0
- package/external/folly/folly/synchronization/detail/test/BUCK +28 -0
- package/external/folly/folly/synchronization/detail/test/HardwareTest.cpp +74 -0
- package/external/folly/folly/synchronization/detail/test/InlineFunctionRefTest.cpp +286 -0
- package/external/folly/folly/synchronization/example/BUCK +27 -0
- package/external/folly/folly/synchronization/example/HazptrLockFreeLIFO.h +88 -0
- package/external/folly/folly/synchronization/example/HazptrSWMRSet.h +133 -0
- package/external/folly/folly/synchronization/example/HazptrWideCAS.h +62 -0
- package/external/folly/folly/synchronization/test/AtomicNotificationTest.cpp +236 -0
- package/external/folly/folly/synchronization/test/AtomicRefTest.cpp +170 -0
- package/external/folly/folly/synchronization/test/AtomicStructTest.cpp +65 -0
- package/external/folly/folly/synchronization/test/AtomicUtilBench.cpp +457 -0
- package/external/folly/folly/synchronization/test/AtomicUtilTest.cpp +650 -0
- package/external/folly/folly/synchronization/test/BUCK +495 -0
- package/external/folly/folly/synchronization/test/Barrier.h +52 -0
- package/external/folly/folly/synchronization/test/BarrierTest.cpp +56 -0
- package/external/folly/folly/synchronization/test/BatonBenchmark.cpp +77 -0
- package/external/folly/folly/synchronization/test/BatonTest.cpp +164 -0
- package/external/folly/folly/synchronization/test/BatonTestHelpers.h +118 -0
- package/external/folly/folly/synchronization/test/CallOnceBenchmark.cpp +72 -0
- package/external/folly/folly/synchronization/test/CallOnceTest.cpp +153 -0
- package/external/folly/folly/synchronization/test/DelayedInitTest.cpp +281 -0
- package/external/folly/folly/synchronization/test/DistributedMutexTest.cpp +2074 -0
- package/external/folly/folly/synchronization/test/EventCountTest.cpp +124 -0
- package/external/folly/folly/synchronization/test/FlatCombiningBenchmark.cpp +1789 -0
- package/external/folly/folly/synchronization/test/FlatCombiningExamples.h +222 -0
- package/external/folly/folly/synchronization/test/FlatCombiningTest.cpp +121 -0
- package/external/folly/folly/synchronization/test/FlatCombiningTestHelpers.h +227 -0
- package/external/folly/folly/synchronization/test/HazptrTest.cpp +1689 -0
- package/external/folly/folly/synchronization/test/LatchTest.cpp +224 -0
- package/external/folly/folly/synchronization/test/LifoSemBench.cpp +185 -0
- package/external/folly/folly/synchronization/test/LifoSemTests.cpp +353 -0
- package/external/folly/folly/synchronization/test/LockTest.cpp +1239 -0
- package/external/folly/folly/synchronization/test/NativeSemaphoreTest.cpp +37 -0
- package/external/folly/folly/synchronization/test/ParkingLotBenchmark.cpp +239 -0
- package/external/folly/folly/synchronization/test/ParkingLotTest.cpp +170 -0
- package/external/folly/folly/synchronization/test/RWSpinLockTest.cpp +235 -0
- package/external/folly/folly/synchronization/test/RcuBench.cpp +66 -0
- package/external/folly/folly/synchronization/test/RcuTest.cpp +330 -0
- package/external/folly/folly/synchronization/test/RelaxedAtomicTest.cpp +389 -0
- package/external/folly/folly/synchronization/test/SaturatingSemaphoreTest.cpp +166 -0
- package/external/folly/folly/synchronization/test/Semaphore.h +242 -0
- package/external/folly/folly/synchronization/test/SemaphoreTest.cpp +271 -0
- package/external/folly/folly/synchronization/test/SmallLocksBenchmark.cpp +1296 -0
- package/external/folly/folly/synchronization/test/SmallLocksTest.cpp +510 -0
- package/external/folly/folly/synchronization/test/ThreadCachedEpochBench.h +67 -0
- package/external/folly/folly/synchronization/test/ThreadCachedReadersBench.cpp +42 -0
- package/external/folly/folly/synchronization/test/ThreadCachedReadersTest.cpp +52 -0
- package/external/folly/folly/synchronization/test/ThrottledLifoSemTest.cpp +243 -0
- package/external/folly/folly/system/AtFork.cpp +205 -0
- package/external/folly/folly/system/AtFork.h +116 -0
- package/external/folly/folly/system/AuxVector.h +198 -0
- package/external/folly/folly/system/BUCK +144 -0
- package/external/folly/folly/system/EnvUtil.cpp +93 -0
- package/external/folly/folly/system/EnvUtil.h +113 -0
- package/external/folly/folly/system/HardwareConcurrency.cpp +39 -0
- package/external/folly/folly/system/HardwareConcurrency.h +23 -0
- package/external/folly/folly/system/MemoryMapping.cpp +477 -0
- package/external/folly/folly/system/MemoryMapping.h +287 -0
- package/external/folly/folly/system/Pid.cpp +87 -0
- package/external/folly/folly/system/Pid.h +34 -0
- package/external/folly/folly/system/Shell.cpp +33 -0
- package/external/folly/folly/system/Shell.h +93 -0
- package/external/folly/folly/system/ThreadId.cpp +89 -0
- package/external/folly/folly/system/ThreadId.h +62 -0
- package/external/folly/folly/system/ThreadName.cpp +330 -0
- package/external/folly/folly/system/ThreadName.h +72 -0
- package/external/folly/folly/system/test/AtForkTest.cpp +309 -0
- package/external/folly/folly/system/test/AuxVectorTest.cpp +55 -0
- package/external/folly/folly/system/test/BUCK +120 -0
- package/external/folly/folly/system/test/EnvUtilSubprocess.cpp +26 -0
- package/external/folly/folly/system/test/EnvUtilTest.cpp +197 -0
- package/external/folly/folly/system/test/MemoryMappingTest.cpp +179 -0
- package/external/folly/folly/system/test/PidTest.cpp +46 -0
- package/external/folly/folly/system/test/ShellTest.cpp +66 -0
- package/external/folly/folly/system/test/ThreadIdTest.cpp +114 -0
- package/external/folly/folly/system/test/ThreadNameTest.cpp +85 -0
- package/external/folly/folly.vcxitems +164 -0
- package/external/folly/static/logo.svg +1 -0
- package/external/folly/sync-config.json +8 -0
- package/package.json +8 -8
- package/templates/cpp-lib/example/metro.config.js +18 -2
|
@@ -0,0 +1,1205 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
#include <folly/Conv.h>
|
|
18
|
+
|
|
19
|
+
#include <array>
|
|
20
|
+
#include <istream>
|
|
21
|
+
|
|
22
|
+
#include <folly/lang/SafeAssert.h>
|
|
23
|
+
|
|
24
|
+
#include <fast_float/fast_float.h> // @manual=fbsource//third-party/fast_float:fast_float
|
|
25
|
+
|
|
26
|
+
namespace folly {
|
|
27
|
+
namespace detail {
|
|
28
|
+
|
|
29
|
+
namespace {
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Finds the first non-digit in a string. The number of digits
|
|
33
|
+
* searched depends on the precision of the Tgt integral. Assumes the
|
|
34
|
+
* string starts with NO whitespace and NO sign.
|
|
35
|
+
*
|
|
36
|
+
* The semantics of the routine is:
|
|
37
|
+
* for (;; ++b) {
|
|
38
|
+
* if (b >= e || !isdigit(*b)) return b;
|
|
39
|
+
* }
|
|
40
|
+
*
|
|
41
|
+
* Complete unrolling marks bottom-line (i.e. entire conversion)
|
|
42
|
+
* improvements of 20%.
|
|
43
|
+
*/
|
|
44
|
+
inline const char* findFirstNonDigit(const char* b, const char* e) {
|
|
45
|
+
for (; b < e; ++b) {
|
|
46
|
+
auto const c = static_cast<unsigned>(*b) - '0';
|
|
47
|
+
if (c >= 10) {
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return b;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Maximum value of number when represented as a string
|
|
55
|
+
template <class T>
|
|
56
|
+
struct MaxString {
|
|
57
|
+
static const char* const value;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
template <>
|
|
61
|
+
const char* const MaxString<uint8_t>::value = "255";
|
|
62
|
+
template <>
|
|
63
|
+
const char* const MaxString<uint16_t>::value = "65535";
|
|
64
|
+
template <>
|
|
65
|
+
const char* const MaxString<uint32_t>::value = "4294967295";
|
|
66
|
+
#if __SIZEOF_LONG__ == 4
|
|
67
|
+
template <>
|
|
68
|
+
const char* const MaxString<unsigned long>::value = "4294967295";
|
|
69
|
+
#else
|
|
70
|
+
template <>
|
|
71
|
+
const char* const MaxString<unsigned long>::value = "18446744073709551615";
|
|
72
|
+
#endif
|
|
73
|
+
static_assert(
|
|
74
|
+
sizeof(unsigned long) >= 4,
|
|
75
|
+
"Wrong value for MaxString<unsigned long>::value,"
|
|
76
|
+
" please update.");
|
|
77
|
+
template <>
|
|
78
|
+
const char* const MaxString<unsigned long long>::value = "18446744073709551615";
|
|
79
|
+
static_assert(
|
|
80
|
+
sizeof(unsigned long long) >= 8,
|
|
81
|
+
"Wrong value for MaxString<unsigned long long>::value"
|
|
82
|
+
", please update.");
|
|
83
|
+
|
|
84
|
+
#if FOLLY_HAVE_INT128_T
|
|
85
|
+
template <>
|
|
86
|
+
const char* const MaxString<__uint128_t>::value =
|
|
87
|
+
"340282366920938463463374607431768211455";
|
|
88
|
+
#endif
|
|
89
|
+
|
|
90
|
+
/*
|
|
91
|
+
* Lookup tables that converts from a decimal character value to an integral
|
|
92
|
+
* binary value, shifted by a decimal "shift" multiplier.
|
|
93
|
+
* For all character values in the range '0'..'9', the table at those
|
|
94
|
+
* index locations returns the actual decimal value shifted by the multiplier.
|
|
95
|
+
* For all other values, the lookup table returns an invalid OOR value.
|
|
96
|
+
*/
|
|
97
|
+
// Out-of-range flag value, larger than the largest value that can fit in
|
|
98
|
+
// four decimal bytes (9999), but four of these added up together should
|
|
99
|
+
// still not overflow uint16_t.
|
|
100
|
+
constexpr int32_t OOR = 10000;
|
|
101
|
+
|
|
102
|
+
alignas(16) constexpr uint16_t shift1[] = {
|
|
103
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 0-9
|
|
104
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 10
|
|
105
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 20
|
|
106
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 30
|
|
107
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, 0, 1, // 40
|
|
108
|
+
2, 3, 4, 5, 6, 7, 8, 9, OOR, OOR,
|
|
109
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 60
|
|
110
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 70
|
|
111
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 80
|
|
112
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 90
|
|
113
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 100
|
|
114
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 110
|
|
115
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 120
|
|
116
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 130
|
|
117
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 140
|
|
118
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 150
|
|
119
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 160
|
|
120
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 170
|
|
121
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 180
|
|
122
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 190
|
|
123
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 200
|
|
124
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 210
|
|
125
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 220
|
|
126
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 230
|
|
127
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 240
|
|
128
|
+
OOR, OOR, OOR, OOR, OOR, OOR // 250
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
alignas(16) constexpr uint16_t shift10[] = {
|
|
132
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 0-9
|
|
133
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 10
|
|
134
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 20
|
|
135
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 30
|
|
136
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, 0, 10, // 40
|
|
137
|
+
20, 30, 40, 50, 60, 70, 80, 90, OOR, OOR,
|
|
138
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 60
|
|
139
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 70
|
|
140
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 80
|
|
141
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 90
|
|
142
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 100
|
|
143
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 110
|
|
144
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 120
|
|
145
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 130
|
|
146
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 140
|
|
147
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 150
|
|
148
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 160
|
|
149
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 170
|
|
150
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 180
|
|
151
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 190
|
|
152
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 200
|
|
153
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 210
|
|
154
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 220
|
|
155
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 230
|
|
156
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 240
|
|
157
|
+
OOR, OOR, OOR, OOR, OOR, OOR // 250
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
alignas(16) constexpr uint16_t shift100[] = {
|
|
161
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 0-9
|
|
162
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 10
|
|
163
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 20
|
|
164
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 30
|
|
165
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, 0, 100, // 40
|
|
166
|
+
200, 300, 400, 500, 600, 700, 800, 900, OOR, OOR,
|
|
167
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 60
|
|
168
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 70
|
|
169
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 80
|
|
170
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 90
|
|
171
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 100
|
|
172
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 110
|
|
173
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 120
|
|
174
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 130
|
|
175
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 140
|
|
176
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 150
|
|
177
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 160
|
|
178
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 170
|
|
179
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 180
|
|
180
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 190
|
|
181
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 200
|
|
182
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 210
|
|
183
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 220
|
|
184
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 230
|
|
185
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 240
|
|
186
|
+
OOR, OOR, OOR, OOR, OOR, OOR // 250
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
alignas(16) constexpr uint16_t shift1000[] = {
|
|
190
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 0-9
|
|
191
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 10
|
|
192
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 20
|
|
193
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 30
|
|
194
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, 0, 1000, // 40
|
|
195
|
+
2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, OOR, OOR,
|
|
196
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 60
|
|
197
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 70
|
|
198
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 80
|
|
199
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 90
|
|
200
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 100
|
|
201
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 110
|
|
202
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 120
|
|
203
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 130
|
|
204
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 140
|
|
205
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 150
|
|
206
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 160
|
|
207
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 170
|
|
208
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 180
|
|
209
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 190
|
|
210
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 200
|
|
211
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 210
|
|
212
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 220
|
|
213
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 230
|
|
214
|
+
OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, OOR, // 240
|
|
215
|
+
OOR, OOR, OOR, OOR, OOR, OOR // 250
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
struct ErrorString {
|
|
219
|
+
const char* string;
|
|
220
|
+
bool quote;
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
// Keep this in sync with ConversionCode in Conv.h
|
|
224
|
+
constexpr const std::array<
|
|
225
|
+
ErrorString,
|
|
226
|
+
static_cast<std::size_t>(ConversionCode::NUM_ERROR_CODES)>
|
|
227
|
+
kErrorStrings{{
|
|
228
|
+
{"Success", true},
|
|
229
|
+
{"Empty input string", true},
|
|
230
|
+
{"No digits found in input string", true},
|
|
231
|
+
{"Integer overflow when parsing bool (must be 0 or 1)", true},
|
|
232
|
+
{"Invalid value for bool", true},
|
|
233
|
+
{"Non-digit character found", true},
|
|
234
|
+
{"Invalid leading character", true},
|
|
235
|
+
{"Overflow during conversion", true},
|
|
236
|
+
{"Negative overflow during conversion", true},
|
|
237
|
+
{"Unable to convert string to floating point value", true},
|
|
238
|
+
{"Non-whitespace character found after end of conversion", true},
|
|
239
|
+
{"Overflow during arithmetic conversion", false},
|
|
240
|
+
{"Negative overflow during arithmetic conversion", false},
|
|
241
|
+
{"Loss of precision during arithmetic conversion", false},
|
|
242
|
+
}};
|
|
243
|
+
|
|
244
|
+
// Check if ASCII is really ASCII
|
|
245
|
+
using IsAscii =
|
|
246
|
+
std::bool_constant<'A' == 65 && 'Z' == 90 && 'a' == 97 && 'z' == 122>;
|
|
247
|
+
|
|
248
|
+
// The code in this file that uses tolower() really only cares about
|
|
249
|
+
// 7-bit ASCII characters, so we can take a nice shortcut here.
|
|
250
|
+
inline char tolower_ascii(char in) {
|
|
251
|
+
return IsAscii::value ? in | 0x20 : char(std::tolower(in));
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
inline bool bool_str_cmp(const char** b, size_t len, const char* value) {
|
|
255
|
+
// Can't use strncasecmp, since we want to ensure that the full value matches
|
|
256
|
+
const char* p = *b;
|
|
257
|
+
const char* e = *b + len;
|
|
258
|
+
const char* v = value;
|
|
259
|
+
while (*v != '\0') {
|
|
260
|
+
if (p == e || tolower_ascii(*p) != *v) { // value is already lowercase
|
|
261
|
+
return false;
|
|
262
|
+
}
|
|
263
|
+
++p;
|
|
264
|
+
++v;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
*b = p;
|
|
268
|
+
return true;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
} // namespace
|
|
272
|
+
|
|
273
|
+
Expected<bool, ConversionCode> str_to_bool(StringPiece* src) noexcept {
|
|
274
|
+
auto b = src->begin(), e = src->end();
|
|
275
|
+
for (;; ++b) {
|
|
276
|
+
if (b >= e) {
|
|
277
|
+
return makeUnexpected(ConversionCode::EMPTY_INPUT_STRING);
|
|
278
|
+
}
|
|
279
|
+
if ((*b < '\t' || *b > '\r') && *b != ' ') {
|
|
280
|
+
break;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
bool result;
|
|
285
|
+
auto len = size_t(e - b);
|
|
286
|
+
switch (*b) {
|
|
287
|
+
case '0':
|
|
288
|
+
case '1': {
|
|
289
|
+
result = false;
|
|
290
|
+
for (; b < e && isdigit(*b); ++b) {
|
|
291
|
+
if (result || (*b != '0' && *b != '1')) {
|
|
292
|
+
return makeUnexpected(ConversionCode::BOOL_OVERFLOW);
|
|
293
|
+
}
|
|
294
|
+
result = (*b == '1');
|
|
295
|
+
}
|
|
296
|
+
break;
|
|
297
|
+
}
|
|
298
|
+
case 'y':
|
|
299
|
+
case 'Y':
|
|
300
|
+
result = true;
|
|
301
|
+
if (!bool_str_cmp(&b, len, "yes")) {
|
|
302
|
+
++b; // accept the single 'y' character
|
|
303
|
+
}
|
|
304
|
+
break;
|
|
305
|
+
case 'n':
|
|
306
|
+
case 'N':
|
|
307
|
+
result = false;
|
|
308
|
+
if (!bool_str_cmp(&b, len, "no")) {
|
|
309
|
+
++b;
|
|
310
|
+
}
|
|
311
|
+
break;
|
|
312
|
+
case 't':
|
|
313
|
+
case 'T':
|
|
314
|
+
result = true;
|
|
315
|
+
if (!bool_str_cmp(&b, len, "true")) {
|
|
316
|
+
++b;
|
|
317
|
+
}
|
|
318
|
+
break;
|
|
319
|
+
case 'f':
|
|
320
|
+
case 'F':
|
|
321
|
+
result = false;
|
|
322
|
+
if (!bool_str_cmp(&b, len, "false")) {
|
|
323
|
+
++b;
|
|
324
|
+
}
|
|
325
|
+
break;
|
|
326
|
+
case 'o':
|
|
327
|
+
case 'O':
|
|
328
|
+
if (bool_str_cmp(&b, len, "on")) {
|
|
329
|
+
result = true;
|
|
330
|
+
} else if (bool_str_cmp(&b, len, "off")) {
|
|
331
|
+
result = false;
|
|
332
|
+
} else {
|
|
333
|
+
return makeUnexpected(ConversionCode::BOOL_INVALID_VALUE);
|
|
334
|
+
}
|
|
335
|
+
break;
|
|
336
|
+
default:
|
|
337
|
+
return makeUnexpected(ConversionCode::BOOL_INVALID_VALUE);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
src->assign(b, e);
|
|
341
|
+
|
|
342
|
+
return result;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/// Uses `double_conversion` library to convert from string to a floating
|
|
346
|
+
/// point.
|
|
347
|
+
template <class Tgt>
|
|
348
|
+
Expected<Tgt, ConversionCode> str_to_floating_double_conversion(
|
|
349
|
+
StringPiece* src) noexcept {
|
|
350
|
+
using namespace double_conversion;
|
|
351
|
+
static StringToDoubleConverter conv(
|
|
352
|
+
StringToDoubleConverter::ALLOW_TRAILING_JUNK |
|
|
353
|
+
StringToDoubleConverter::ALLOW_LEADING_SPACES,
|
|
354
|
+
0.0,
|
|
355
|
+
// return this for junk input string
|
|
356
|
+
std::numeric_limits<Tgt>::quiet_NaN(),
|
|
357
|
+
nullptr,
|
|
358
|
+
nullptr);
|
|
359
|
+
|
|
360
|
+
if (src->empty()) {
|
|
361
|
+
return makeUnexpected(ConversionCode::EMPTY_INPUT_STRING);
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
int length; // processed char count
|
|
365
|
+
auto result = std::is_same<Tgt, float>::value
|
|
366
|
+
? conv.StringToFloat(src->data(), static_cast<int>(src->size()), &length)
|
|
367
|
+
: static_cast<Tgt>(conv.StringToDouble(
|
|
368
|
+
src->data(), static_cast<int>(src->size()), &length));
|
|
369
|
+
|
|
370
|
+
if (!std::isnan(result)) {
|
|
371
|
+
// If we get here with length = 0, the input string is empty.
|
|
372
|
+
// If we get here with result = 0.0, it's either because the string
|
|
373
|
+
// contained only whitespace, or because we had an actual zero value
|
|
374
|
+
// (with potential trailing junk). If it was only whitespace, we
|
|
375
|
+
// want to raise an error; length will point past the last character
|
|
376
|
+
// that was processed, so we need to check if that character was
|
|
377
|
+
// whitespace or not.
|
|
378
|
+
if (length == 0 ||
|
|
379
|
+
(result == 0.0 && std::isspace((*src)[size_t(length) - 1]))) {
|
|
380
|
+
return makeUnexpected(ConversionCode::EMPTY_INPUT_STRING);
|
|
381
|
+
}
|
|
382
|
+
if (length >= 2) {
|
|
383
|
+
const char* suffix = src->data() + length - 1;
|
|
384
|
+
// double_conversion doesn't update length correctly when there is an
|
|
385
|
+
// incomplete exponent specifier. Converting "12e-f-g" shouldn't consume
|
|
386
|
+
// any more than "12", but it will consume "12e-".
|
|
387
|
+
|
|
388
|
+
// "123-" should only parse "123"
|
|
389
|
+
if (*suffix == '-' || *suffix == '+') {
|
|
390
|
+
--suffix;
|
|
391
|
+
--length;
|
|
392
|
+
}
|
|
393
|
+
// "12e-f-g" or "12euro" should only parse "12"
|
|
394
|
+
if (*suffix == 'e' || *suffix == 'E') {
|
|
395
|
+
--length;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
src->advance(size_t(length));
|
|
399
|
+
return Tgt(result);
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
auto* e = src->end();
|
|
403
|
+
auto* b = std::find_if_not(src->begin(), e, [](char c) {
|
|
404
|
+
return (c >= '\t' && c <= '\r') || c == ' ';
|
|
405
|
+
});
|
|
406
|
+
if (b == e) {
|
|
407
|
+
return makeUnexpected(ConversionCode::EMPTY_INPUT_STRING);
|
|
408
|
+
}
|
|
409
|
+
auto size = size_t(e - b);
|
|
410
|
+
|
|
411
|
+
bool negative = false;
|
|
412
|
+
if (*b == '-') {
|
|
413
|
+
negative = true;
|
|
414
|
+
++b;
|
|
415
|
+
--size;
|
|
416
|
+
if (size == 0) {
|
|
417
|
+
return makeUnexpected(ConversionCode::STRING_TO_FLOAT_ERROR);
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
assert(size > 0);
|
|
421
|
+
|
|
422
|
+
result = 0.0;
|
|
423
|
+
|
|
424
|
+
switch (tolower_ascii(*b)) {
|
|
425
|
+
case 'i':
|
|
426
|
+
if (size >= 3 && tolower_ascii(b[1]) == 'n' &&
|
|
427
|
+
tolower_ascii(b[2]) == 'f') {
|
|
428
|
+
if (size >= 8 && tolower_ascii(b[3]) == 'i' &&
|
|
429
|
+
tolower_ascii(b[4]) == 'n' && tolower_ascii(b[5]) == 'i' &&
|
|
430
|
+
tolower_ascii(b[6]) == 't' && tolower_ascii(b[7]) == 'y') {
|
|
431
|
+
b += 8;
|
|
432
|
+
} else {
|
|
433
|
+
b += 3;
|
|
434
|
+
}
|
|
435
|
+
result = std::numeric_limits<Tgt>::infinity();
|
|
436
|
+
}
|
|
437
|
+
break;
|
|
438
|
+
|
|
439
|
+
case 'n':
|
|
440
|
+
if (size >= 3 && tolower_ascii(b[1]) == 'a' &&
|
|
441
|
+
tolower_ascii(b[2]) == 'n') {
|
|
442
|
+
b += 3;
|
|
443
|
+
result = std::numeric_limits<Tgt>::quiet_NaN();
|
|
444
|
+
}
|
|
445
|
+
break;
|
|
446
|
+
|
|
447
|
+
default:
|
|
448
|
+
break;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
if (result == 0.0) {
|
|
452
|
+
// All bets are off
|
|
453
|
+
return makeUnexpected(ConversionCode::STRING_TO_FLOAT_ERROR);
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
if (negative) {
|
|
457
|
+
result = -result;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
src->assign(b, e);
|
|
461
|
+
|
|
462
|
+
return Tgt(result);
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
/// Uses `fast_float::from_chars` to convert from string to an integer.
|
|
466
|
+
template <class Tgt>
|
|
467
|
+
Expected<Tgt, ConversionCode> str_to_floating_fast_float_from_chars(
|
|
468
|
+
StringPiece* src) noexcept {
|
|
469
|
+
if (src->empty()) {
|
|
470
|
+
return makeUnexpected(ConversionCode::EMPTY_INPUT_STRING);
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
// move through leading whitespace characters
|
|
474
|
+
auto* e = src->end();
|
|
475
|
+
auto* b = std::find_if_not(src->begin(), e, [](char c) {
|
|
476
|
+
return (c >= '\t' && c <= '\r') || c == ' ';
|
|
477
|
+
});
|
|
478
|
+
if (b == e) {
|
|
479
|
+
return makeUnexpected(ConversionCode::EMPTY_INPUT_STRING);
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
Tgt result;
|
|
483
|
+
auto [ptr, ec] = fast_float::from_chars(b, e, result);
|
|
484
|
+
bool isOutOfRange{ec == std::errc::result_out_of_range};
|
|
485
|
+
bool isOk{ec == std::errc()};
|
|
486
|
+
if (!isOk && !isOutOfRange) {
|
|
487
|
+
return makeUnexpected(ConversionCode::STRING_TO_FLOAT_ERROR);
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
auto numMatchedChars = ptr - src->data();
|
|
491
|
+
src->advance(numMatchedChars);
|
|
492
|
+
|
|
493
|
+
if (isOutOfRange) {
|
|
494
|
+
if (*b == '-') {
|
|
495
|
+
return -std::numeric_limits<Tgt>::infinity();
|
|
496
|
+
} else {
|
|
497
|
+
return std::numeric_limits<Tgt>::infinity();
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
return result;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
template Expected<float, ConversionCode>
|
|
505
|
+
str_to_floating_fast_float_from_chars<float>(StringPiece* src) noexcept;
|
|
506
|
+
template Expected<double, ConversionCode>
|
|
507
|
+
str_to_floating_fast_float_from_chars<double>(StringPiece* src) noexcept;
|
|
508
|
+
|
|
509
|
+
/**
|
|
510
|
+
* StringPiece to double, with progress information. Alters the
|
|
511
|
+
* StringPiece parameter to munch the already-parsed characters.
|
|
512
|
+
*/
|
|
513
|
+
template <class Tgt>
|
|
514
|
+
Expected<Tgt, ConversionCode> str_to_floating(StringPiece* src) noexcept {
|
|
515
|
+
#if defined(FOLLY_CONV_ATOD_MODE) && FOLLY_CONV_ATOD_MODE == 1
|
|
516
|
+
return detail::str_to_floating_fast_float_from_chars<Tgt>(src);
|
|
517
|
+
#else
|
|
518
|
+
return detail::str_to_floating_double_conversion<Tgt>(src);
|
|
519
|
+
#endif
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
template Expected<float, ConversionCode> str_to_floating<float>(
|
|
523
|
+
StringPiece* src) noexcept;
|
|
524
|
+
template Expected<double, ConversionCode> str_to_floating<double>(
|
|
525
|
+
StringPiece* src) noexcept;
|
|
526
|
+
|
|
527
|
+
namespace {
|
|
528
|
+
|
|
529
|
+
/**
|
|
530
|
+
* This class takes care of additional processing needed for signed values,
|
|
531
|
+
* like leading sign character and overflow checks.
|
|
532
|
+
*/
|
|
533
|
+
template <typename T, bool IsSigned = is_signed_v<T>>
|
|
534
|
+
class SignedValueHandler;
|
|
535
|
+
|
|
536
|
+
template <typename T>
|
|
537
|
+
class SignedValueHandler<T, true> {
|
|
538
|
+
public:
|
|
539
|
+
ConversionCode init(const char*& b) {
|
|
540
|
+
negative_ = false;
|
|
541
|
+
if (!std::isdigit(*b)) {
|
|
542
|
+
if (*b == '-') {
|
|
543
|
+
negative_ = true;
|
|
544
|
+
} else if (FOLLY_UNLIKELY(*b != '+')) {
|
|
545
|
+
return ConversionCode::INVALID_LEADING_CHAR;
|
|
546
|
+
}
|
|
547
|
+
++b;
|
|
548
|
+
}
|
|
549
|
+
return ConversionCode::SUCCESS;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
ConversionCode overflow() {
|
|
553
|
+
return negative_ ? ConversionCode::NEGATIVE_OVERFLOW
|
|
554
|
+
: ConversionCode::POSITIVE_OVERFLOW;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
template <typename U>
|
|
558
|
+
Expected<T, ConversionCode> finalize(U value) {
|
|
559
|
+
T rv;
|
|
560
|
+
if (negative_) {
|
|
561
|
+
FOLLY_PUSH_WARNING
|
|
562
|
+
FOLLY_MSVC_DISABLE_WARNING(4146)
|
|
563
|
+
|
|
564
|
+
// unary minus operator applied to unsigned type, result still unsigned
|
|
565
|
+
rv = T(-value);
|
|
566
|
+
|
|
567
|
+
FOLLY_POP_WARNING
|
|
568
|
+
|
|
569
|
+
if (FOLLY_UNLIKELY(rv > 0)) {
|
|
570
|
+
return makeUnexpected(ConversionCode::NEGATIVE_OVERFLOW);
|
|
571
|
+
}
|
|
572
|
+
} else {
|
|
573
|
+
rv = T(value);
|
|
574
|
+
if (FOLLY_UNLIKELY(rv < 0)) {
|
|
575
|
+
return makeUnexpected(ConversionCode::POSITIVE_OVERFLOW);
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
return rv;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
private:
|
|
582
|
+
bool negative_;
|
|
583
|
+
};
|
|
584
|
+
|
|
585
|
+
// For unsigned types, we don't need any extra processing
|
|
586
|
+
template <typename T>
|
|
587
|
+
class SignedValueHandler<T, false> {
|
|
588
|
+
public:
|
|
589
|
+
ConversionCode init(const char*&) { return ConversionCode::SUCCESS; }
|
|
590
|
+
|
|
591
|
+
ConversionCode overflow() { return ConversionCode::POSITIVE_OVERFLOW; }
|
|
592
|
+
|
|
593
|
+
Expected<T, ConversionCode> finalize(T value) { return value; }
|
|
594
|
+
};
|
|
595
|
+
|
|
596
|
+
} // namespace
|
|
597
|
+
|
|
598
|
+
/**
|
|
599
|
+
* String represented as a pair of pointers to char to signed/unsigned
|
|
600
|
+
* integrals. Assumes NO whitespace before or after, and also that the
|
|
601
|
+
* string is composed entirely of digits (and an optional sign only for
|
|
602
|
+
* signed types). String may be empty, in which case digits_to returns
|
|
603
|
+
* an appropriate error.
|
|
604
|
+
*/
|
|
605
|
+
template <class Tgt>
|
|
606
|
+
inline Expected<Tgt, ConversionCode> digits_to(
|
|
607
|
+
const char* b, const char* const e) noexcept {
|
|
608
|
+
using UT = make_unsigned_t<Tgt>;
|
|
609
|
+
assert(b <= e);
|
|
610
|
+
|
|
611
|
+
SignedValueHandler<Tgt> sgn;
|
|
612
|
+
|
|
613
|
+
auto err = sgn.init(b);
|
|
614
|
+
if (FOLLY_UNLIKELY(err != ConversionCode::SUCCESS)) {
|
|
615
|
+
return makeUnexpected(err);
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
auto size = size_t(e - b);
|
|
619
|
+
|
|
620
|
+
/* Although the string is entirely made of digits, we still need to
|
|
621
|
+
* check for overflow.
|
|
622
|
+
*/
|
|
623
|
+
if (size > std::numeric_limits<UT>::digits10) {
|
|
624
|
+
// Leading zeros?
|
|
625
|
+
if (b < e && *b == '0') {
|
|
626
|
+
for (++b;; ++b) {
|
|
627
|
+
if (b == e) {
|
|
628
|
+
return Tgt(0); // just zeros, e.g. "0000"
|
|
629
|
+
}
|
|
630
|
+
if (*b != '0') {
|
|
631
|
+
size = size_t(e - b);
|
|
632
|
+
break;
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
if (size > std::numeric_limits<UT>::digits10 &&
|
|
637
|
+
(size != std::numeric_limits<UT>::digits10 + 1 ||
|
|
638
|
+
strncmp(b, MaxString<UT>::value, size) > 0)) {
|
|
639
|
+
return makeUnexpected(sgn.overflow());
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
// Here we know that the number won't overflow when
|
|
644
|
+
// converted. Proceed without checks.
|
|
645
|
+
|
|
646
|
+
UT result = 0;
|
|
647
|
+
|
|
648
|
+
for (; e - b >= 4; b += 4) {
|
|
649
|
+
result *= UT(10000);
|
|
650
|
+
const int32_t r0 = shift1000[static_cast<size_t>(b[0])];
|
|
651
|
+
const int32_t r1 = shift100[static_cast<size_t>(b[1])];
|
|
652
|
+
const int32_t r2 = shift10[static_cast<size_t>(b[2])];
|
|
653
|
+
const int32_t r3 = shift1[static_cast<size_t>(b[3])];
|
|
654
|
+
const auto sum = r0 + r1 + r2 + r3;
|
|
655
|
+
if (sum >= OOR) {
|
|
656
|
+
goto outOfRange;
|
|
657
|
+
}
|
|
658
|
+
result += UT(sum);
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
switch (e - b) {
|
|
662
|
+
case 3: {
|
|
663
|
+
const int32_t r0 = shift100[static_cast<size_t>(b[0])];
|
|
664
|
+
const int32_t r1 = shift10[static_cast<size_t>(b[1])];
|
|
665
|
+
const int32_t r2 = shift1[static_cast<size_t>(b[2])];
|
|
666
|
+
const auto sum = r0 + r1 + r2;
|
|
667
|
+
if (sum >= OOR) {
|
|
668
|
+
goto outOfRange;
|
|
669
|
+
}
|
|
670
|
+
result = UT(1000 * result + sum);
|
|
671
|
+
break;
|
|
672
|
+
}
|
|
673
|
+
case 2: {
|
|
674
|
+
const int32_t r0 = shift10[static_cast<size_t>(b[0])];
|
|
675
|
+
const int32_t r1 = shift1[static_cast<size_t>(b[1])];
|
|
676
|
+
const auto sum = r0 + r1;
|
|
677
|
+
if (sum >= OOR) {
|
|
678
|
+
goto outOfRange;
|
|
679
|
+
}
|
|
680
|
+
result = UT(100 * result + sum);
|
|
681
|
+
break;
|
|
682
|
+
}
|
|
683
|
+
case 1: {
|
|
684
|
+
const int32_t sum = shift1[static_cast<size_t>(b[0])];
|
|
685
|
+
if (sum >= OOR) {
|
|
686
|
+
goto outOfRange;
|
|
687
|
+
}
|
|
688
|
+
result = UT(10 * result + sum);
|
|
689
|
+
break;
|
|
690
|
+
}
|
|
691
|
+
default:
|
|
692
|
+
assert(b == e);
|
|
693
|
+
if (size == 0) {
|
|
694
|
+
return makeUnexpected(ConversionCode::NO_DIGITS);
|
|
695
|
+
}
|
|
696
|
+
break;
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
return sgn.finalize(result);
|
|
700
|
+
|
|
701
|
+
outOfRange:
|
|
702
|
+
return makeUnexpected(ConversionCode::NON_DIGIT_CHAR);
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
template Expected<char, ConversionCode> digits_to<char>(
|
|
706
|
+
const char*, const char*) noexcept;
|
|
707
|
+
template Expected<signed char, ConversionCode> digits_to<signed char>(
|
|
708
|
+
const char*, const char*) noexcept;
|
|
709
|
+
template Expected<unsigned char, ConversionCode> digits_to<unsigned char>(
|
|
710
|
+
const char*, const char*) noexcept;
|
|
711
|
+
|
|
712
|
+
template Expected<short, ConversionCode> digits_to<short>(
|
|
713
|
+
const char*, const char*) noexcept;
|
|
714
|
+
template Expected<unsigned short, ConversionCode> digits_to<unsigned short>(
|
|
715
|
+
const char*, const char*) noexcept;
|
|
716
|
+
|
|
717
|
+
template Expected<int, ConversionCode> digits_to<int>(
|
|
718
|
+
const char*, const char*) noexcept;
|
|
719
|
+
template Expected<unsigned int, ConversionCode> digits_to<unsigned int>(
|
|
720
|
+
const char*, const char*) noexcept;
|
|
721
|
+
|
|
722
|
+
template Expected<long, ConversionCode> digits_to<long>(
|
|
723
|
+
const char*, const char*) noexcept;
|
|
724
|
+
template Expected<unsigned long, ConversionCode> digits_to<unsigned long>(
|
|
725
|
+
const char*, const char*) noexcept;
|
|
726
|
+
|
|
727
|
+
template Expected<long long, ConversionCode> digits_to<long long>(
|
|
728
|
+
const char*, const char*) noexcept;
|
|
729
|
+
template Expected<unsigned long long, ConversionCode>
|
|
730
|
+
digits_to<unsigned long long>(const char*, const char*) noexcept;
|
|
731
|
+
|
|
732
|
+
#if FOLLY_HAVE_INT128_T
|
|
733
|
+
template Expected<__int128, ConversionCode> digits_to<__int128>(
|
|
734
|
+
const char*, const char*) noexcept;
|
|
735
|
+
template Expected<unsigned __int128, ConversionCode>
|
|
736
|
+
digits_to<unsigned __int128>(const char*, const char*) noexcept;
|
|
737
|
+
#endif
|
|
738
|
+
|
|
739
|
+
/**
|
|
740
|
+
* StringPiece to integrals, with progress information. Alters the
|
|
741
|
+
* StringPiece parameter to munch the already-parsed characters.
|
|
742
|
+
*/
|
|
743
|
+
template <class Tgt>
|
|
744
|
+
Expected<Tgt, ConversionCode> str_to_integral(StringPiece* src) noexcept {
|
|
745
|
+
using UT = make_unsigned_t<Tgt>;
|
|
746
|
+
|
|
747
|
+
auto b = src->data(), past = src->data() + src->size();
|
|
748
|
+
|
|
749
|
+
for (;; ++b) {
|
|
750
|
+
if (FOLLY_UNLIKELY(b >= past)) {
|
|
751
|
+
return makeUnexpected(ConversionCode::EMPTY_INPUT_STRING);
|
|
752
|
+
}
|
|
753
|
+
if ((*b < '\t' || *b > '\r') && *b != ' ') {
|
|
754
|
+
break;
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
SignedValueHandler<Tgt> sgn;
|
|
759
|
+
auto err = sgn.init(b);
|
|
760
|
+
|
|
761
|
+
if (FOLLY_UNLIKELY(err != ConversionCode::SUCCESS)) {
|
|
762
|
+
return makeUnexpected(err);
|
|
763
|
+
}
|
|
764
|
+
if (is_signed_v<Tgt> && FOLLY_UNLIKELY(b >= past)) {
|
|
765
|
+
return makeUnexpected(ConversionCode::NO_DIGITS);
|
|
766
|
+
}
|
|
767
|
+
if (FOLLY_UNLIKELY(!isdigit(*b))) {
|
|
768
|
+
return makeUnexpected(ConversionCode::NON_DIGIT_CHAR);
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
auto m = findFirstNonDigit(b + 1, past);
|
|
772
|
+
|
|
773
|
+
auto tmp = digits_to<UT>(b, m);
|
|
774
|
+
|
|
775
|
+
if (FOLLY_UNLIKELY(!tmp.hasValue())) {
|
|
776
|
+
return makeUnexpected(
|
|
777
|
+
tmp.error() == ConversionCode::POSITIVE_OVERFLOW ? sgn.overflow()
|
|
778
|
+
: tmp.error());
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
auto res = sgn.finalize(tmp.value());
|
|
782
|
+
|
|
783
|
+
if (res.hasValue()) {
|
|
784
|
+
src->advance(size_t(m - src->data()));
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
return res;
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
template Expected<char, ConversionCode> str_to_integral<char>(
|
|
791
|
+
StringPiece* src) noexcept;
|
|
792
|
+
template Expected<signed char, ConversionCode> str_to_integral<signed char>(
|
|
793
|
+
StringPiece* src) noexcept;
|
|
794
|
+
template Expected<unsigned char, ConversionCode> str_to_integral<unsigned char>(
|
|
795
|
+
StringPiece* src) noexcept;
|
|
796
|
+
|
|
797
|
+
template Expected<short, ConversionCode> str_to_integral<short>(
|
|
798
|
+
StringPiece* src) noexcept;
|
|
799
|
+
template Expected<unsigned short, ConversionCode>
|
|
800
|
+
str_to_integral<unsigned short>(StringPiece* src) noexcept;
|
|
801
|
+
|
|
802
|
+
template Expected<int, ConversionCode> str_to_integral<int>(
|
|
803
|
+
StringPiece* src) noexcept;
|
|
804
|
+
template Expected<unsigned int, ConversionCode> str_to_integral<unsigned int>(
|
|
805
|
+
StringPiece* src) noexcept;
|
|
806
|
+
|
|
807
|
+
template Expected<long, ConversionCode> str_to_integral<long>(
|
|
808
|
+
StringPiece* src) noexcept;
|
|
809
|
+
template Expected<unsigned long, ConversionCode> str_to_integral<unsigned long>(
|
|
810
|
+
StringPiece* src) noexcept;
|
|
811
|
+
|
|
812
|
+
template Expected<long long, ConversionCode> str_to_integral<long long>(
|
|
813
|
+
StringPiece* src) noexcept;
|
|
814
|
+
template Expected<unsigned long long, ConversionCode>
|
|
815
|
+
str_to_integral<unsigned long long>(StringPiece* src) noexcept;
|
|
816
|
+
|
|
817
|
+
#if FOLLY_HAVE_INT128_T
|
|
818
|
+
template Expected<__int128, ConversionCode> str_to_integral<__int128>(
|
|
819
|
+
StringPiece* src) noexcept;
|
|
820
|
+
template Expected<unsigned __int128, ConversionCode>
|
|
821
|
+
str_to_integral<unsigned __int128>(StringPiece* src) noexcept;
|
|
822
|
+
#endif
|
|
823
|
+
|
|
824
|
+
#if defined(FOLLY_CONV_AVALIABILITY_TO_CHARS_FLOATING_POINT) && \
|
|
825
|
+
FOLLY_CONV_AVALIABILITY_TO_CHARS_FLOATING_POINT == 1
|
|
826
|
+
DtoaFlagsSet::DtoaFlagsSet(DtoaFlags flags) : flags_(flags) {}
|
|
827
|
+
|
|
828
|
+
bool DtoaFlagsSet::isSet(DtoaFlags flag) const {
|
|
829
|
+
return (flags_ & flag) == flag;
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
bool DtoaFlagsSet::emitPositiveExponentSign() const {
|
|
833
|
+
return isSet(DtoaFlags::EMIT_POSITIVE_EXPONENT_SIGN);
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
bool DtoaFlagsSet::emitTrailingDecimalPoint() const {
|
|
837
|
+
return isSet(DtoaFlags::EMIT_TRAILING_DECIMAL_POINT);
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
bool DtoaFlagsSet::emitTrailingZeroAfterPoint() const {
|
|
841
|
+
return isSet(DtoaFlags::EMIT_TRAILING_ZERO_AFTER_POINT);
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
bool DtoaFlagsSet::uniqueZero() const {
|
|
845
|
+
return isSet(DtoaFlags::UNIQUE_ZERO);
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
bool DtoaFlagsSet::noTrailingZero() const {
|
|
849
|
+
return isSet(DtoaFlags::NO_TRAILING_ZERO);
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
int ParsedDecimal::numPrecisionFigures() const {
|
|
853
|
+
int numInts = 0;
|
|
854
|
+
|
|
855
|
+
bool intIsZero = true;
|
|
856
|
+
int numLeadingIntZeros = 0;
|
|
857
|
+
bool isLeadingIntZero = true;
|
|
858
|
+
for (char* p = integerBegin; p && p != integerEnd; p++) {
|
|
859
|
+
if (*p == '0') {
|
|
860
|
+
if (isLeadingIntZero) {
|
|
861
|
+
numLeadingIntZeros += 1;
|
|
862
|
+
} else {
|
|
863
|
+
numInts += 1;
|
|
864
|
+
}
|
|
865
|
+
} else if (std::isdigit(*p)) {
|
|
866
|
+
intIsZero = false;
|
|
867
|
+
isLeadingIntZero = false;
|
|
868
|
+
numInts += 1;
|
|
869
|
+
} else {
|
|
870
|
+
folly::throw_exception<std::runtime_error>("non-numeric int");
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
bool fractionalIsZero = true;
|
|
875
|
+
int numFractional = 0;
|
|
876
|
+
int numLeadingFractionalZeros = 0;
|
|
877
|
+
bool isLeadingFractionalZero = true;
|
|
878
|
+
for (char* p = fractionalBegin; p && p != fractionalEnd; p++) {
|
|
879
|
+
if (*p == '0') {
|
|
880
|
+
if (isLeadingFractionalZero) {
|
|
881
|
+
numLeadingFractionalZeros += 1;
|
|
882
|
+
} else {
|
|
883
|
+
numFractional += 1;
|
|
884
|
+
}
|
|
885
|
+
} else if (std::isdigit(*p)) {
|
|
886
|
+
fractionalIsZero = false;
|
|
887
|
+
isLeadingFractionalZero = false;
|
|
888
|
+
numFractional += 1;
|
|
889
|
+
} else {
|
|
890
|
+
folly::throw_exception<std::runtime_error>("non-numeric frac");
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
if (intIsZero && fractionalIsZero) {
|
|
895
|
+
return numLeadingIntZeros + numLeadingFractionalZeros;
|
|
896
|
+
} else if (intIsZero) {
|
|
897
|
+
return numLeadingFractionalZeros + numFractional;
|
|
898
|
+
} else if (fractionalIsZero) {
|
|
899
|
+
return numInts + numLeadingFractionalZeros + numFractional;
|
|
900
|
+
} else {
|
|
901
|
+
return numInts + numLeadingFractionalZeros + numFractional;
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
std::optional<detail::ParsedDecimal::FractionalSuffix>
|
|
906
|
+
ParsedDecimal::fractionalSuffix() const {
|
|
907
|
+
if (exponentSymbol) {
|
|
908
|
+
if (exponentEnd) {
|
|
909
|
+
return std::make_pair(exponentSymbol, exponentEnd);
|
|
910
|
+
} else if (exponentSign) {
|
|
911
|
+
return std::make_pair(exponentSymbol, exponentSign);
|
|
912
|
+
} else {
|
|
913
|
+
return std::make_pair(exponentSymbol, exponentSymbol + 1);
|
|
914
|
+
}
|
|
915
|
+
} else if (exponentSign) {
|
|
916
|
+
if (exponentEnd) {
|
|
917
|
+
return std::make_pair(exponentSign, exponentEnd);
|
|
918
|
+
} else {
|
|
919
|
+
return std::make_pair(exponentSign, exponentSign + 1);
|
|
920
|
+
}
|
|
921
|
+
} else if (exponentBegin) {
|
|
922
|
+
if (exponentEnd) {
|
|
923
|
+
return std::make_pair(exponentEnd, exponentEnd);
|
|
924
|
+
} else {
|
|
925
|
+
return std::make_pair(exponentBegin, exponentSign + 1);
|
|
926
|
+
}
|
|
927
|
+
} else {
|
|
928
|
+
return std::nullopt;
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
|
|
932
|
+
void ParsedDecimal::shiftFractionalSuffixPtrs(size_t amount) {
|
|
933
|
+
if (exponentSymbol) {
|
|
934
|
+
exponentSymbol += amount;
|
|
935
|
+
}
|
|
936
|
+
if (exponentSign) {
|
|
937
|
+
exponentSign += amount;
|
|
938
|
+
}
|
|
939
|
+
if (exponentBegin) {
|
|
940
|
+
exponentBegin += amount;
|
|
941
|
+
}
|
|
942
|
+
if (exponentEnd) {
|
|
943
|
+
exponentEnd += amount;
|
|
944
|
+
}
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
namespace {
|
|
948
|
+
|
|
949
|
+
struct Stream : std::istream {
|
|
950
|
+
struct CharBuf : std::streambuf {
|
|
951
|
+
CharBuf(char* begin, char* end) { setg(begin, begin, end); }
|
|
952
|
+
|
|
953
|
+
char* pos() const { return gptr(); }
|
|
954
|
+
};
|
|
955
|
+
CharBuf& buf_;
|
|
956
|
+
|
|
957
|
+
explicit Stream(CharBuf& buf) : std::istream(&buf), buf_(buf) {}
|
|
958
|
+
|
|
959
|
+
char* pos() { return buf_.pos(); }
|
|
960
|
+
|
|
961
|
+
void advance() { get(); }
|
|
962
|
+
};
|
|
963
|
+
|
|
964
|
+
} // namespace
|
|
965
|
+
|
|
966
|
+
ParsedDecimal::ParsedDecimal(char* begin, char* end) {
|
|
967
|
+
if (!begin || !end || begin >= end) {
|
|
968
|
+
folly::throw_exception<std::invalid_argument>("invalid args");
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
Stream::CharBuf buf(begin, end);
|
|
972
|
+
Stream stream(buf);
|
|
973
|
+
if (stream.peek() == '-') {
|
|
974
|
+
negativeSign = stream.pos();
|
|
975
|
+
stream.advance();
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
if (char c = static_cast<unsigned char>(stream.peek()); std::isdigit(c)) { // [Windows - fix conversion from 'int' to 'char']
|
|
979
|
+
integerBegin = stream.pos();
|
|
980
|
+
|
|
981
|
+
while (!stream.eof() && std::isdigit(stream.peek())) {
|
|
982
|
+
stream.advance();
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
integerEnd = stream.pos();
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
if (stream.eof()) {
|
|
989
|
+
if (!integerBegin) {
|
|
990
|
+
folly::throw_exception<std::invalid_argument>("no int part");
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
return;
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
if (stream.peek() == '.') {
|
|
997
|
+
decimalPoint = stream.pos();
|
|
998
|
+
stream.advance();
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
if (stream.eof()) {
|
|
1002
|
+
if (!integerBegin) {
|
|
1003
|
+
folly::throw_exception<std::invalid_argument>("no int part");
|
|
1004
|
+
}
|
|
1005
|
+
return;
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
if (char c = static_cast<unsigned char>(stream.peek()); std::isdigit(c)) { // [Windows - fix conversion from 'int' to 'char']
|
|
1009
|
+
fractionalBegin = stream.pos();
|
|
1010
|
+
|
|
1011
|
+
while (!stream.eof() && std::isdigit(stream.peek())) {
|
|
1012
|
+
stream.advance();
|
|
1013
|
+
}
|
|
1014
|
+
|
|
1015
|
+
fractionalEnd = stream.pos();
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
if (!integerBegin && !fractionalBegin) {
|
|
1019
|
+
// there was no integer or fractional part.
|
|
1020
|
+
folly::throw_exception<std::invalid_argument>("no int or frac part");
|
|
1021
|
+
}
|
|
1022
|
+
|
|
1023
|
+
if (stream.eof()) {
|
|
1024
|
+
return;
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
if (stream.peek() == 'e') {
|
|
1028
|
+
exponentSymbol = stream.pos();
|
|
1029
|
+
stream.advance();
|
|
1030
|
+
|
|
1031
|
+
if (stream.eof()) {
|
|
1032
|
+
return;
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1035
|
+
if (char c = static_cast<unsigned char>(stream.peek()); c == '-' || c == '+') { // [Windows - fix conversion from 'int' to 'char']
|
|
1036
|
+
exponentSign = stream.pos();
|
|
1037
|
+
stream.advance();
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
if (char c = static_cast<unsigned char>(stream.peek()); std::isdigit(c)) { // [Windows - fix conversion from 'int' to 'char']
|
|
1041
|
+
exponentBegin = stream.pos();
|
|
1042
|
+
while (!stream.eof() && std::isdigit(stream.peek())) {
|
|
1043
|
+
stream.advance();
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
exponentEnd = stream.pos();
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1050
|
+
while (!stream.eof()) {
|
|
1051
|
+
int c = stream.get();
|
|
1052
|
+
if (c != '\0' && !std::isspace(c)) {
|
|
1053
|
+
folly::throw_exception<std::invalid_argument>("unexpected chars");
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
std::pair<char*, char*> formatAsDoubleConversion(
|
|
1059
|
+
bool valueIsZero,
|
|
1060
|
+
DtoaMode mode,
|
|
1061
|
+
unsigned int numDigits,
|
|
1062
|
+
DtoaFlags flags,
|
|
1063
|
+
char* resultBegin,
|
|
1064
|
+
char* resultEnd,
|
|
1065
|
+
char* bufferEnd) {
|
|
1066
|
+
detail::ParsedDecimal parsedDecimal(resultBegin, resultEnd);
|
|
1067
|
+
detail::DtoaFlagsSet flagsSet{flags};
|
|
1068
|
+
if (parsedDecimal.negativeSign && flagsSet.uniqueZero() && valueIsZero) {
|
|
1069
|
+
// skip the negative sign (-) if it's a zero and UNIQUE_ZERO is set
|
|
1070
|
+
resultBegin += 1;
|
|
1071
|
+
}
|
|
1072
|
+
|
|
1073
|
+
unsigned int numTrailingZerosToAdd = 0;
|
|
1074
|
+
if (!flagsSet.noTrailingZero() && mode == DtoaMode::PRECISION) {
|
|
1075
|
+
// std::to_chars outputs no trailing zeros, so if it's not set, add
|
|
1076
|
+
// trailing zeros
|
|
1077
|
+
unsigned int numPrecisionFigures = parsedDecimal.numPrecisionFigures();
|
|
1078
|
+
if (numDigits > numPrecisionFigures) {
|
|
1079
|
+
numTrailingZerosToAdd = numDigits - numPrecisionFigures;
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1083
|
+
bool insertDecimalPoint = false;
|
|
1084
|
+
char* insertionPoint;
|
|
1085
|
+
if (parsedDecimal.fractionalEnd) {
|
|
1086
|
+
insertionPoint = parsedDecimal.fractionalEnd;
|
|
1087
|
+
} else if (parsedDecimal.decimalPoint) {
|
|
1088
|
+
insertionPoint = parsedDecimal.decimalPoint + 1;
|
|
1089
|
+
} else {
|
|
1090
|
+
insertionPoint = parsedDecimal.integerEnd;
|
|
1091
|
+
if (flagsSet.emitTrailingDecimalPoint() || numTrailingZerosToAdd > 0) {
|
|
1092
|
+
insertDecimalPoint = true;
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1095
|
+
if (flagsSet.emitTrailingZeroAfterPoint()) {
|
|
1096
|
+
numTrailingZerosToAdd += 1;
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
|
|
1100
|
+
unsigned int numCharsToInsert =
|
|
1101
|
+
numTrailingZerosToAdd + (insertDecimalPoint ? 1 : 0);
|
|
1102
|
+
|
|
1103
|
+
if (numCharsToInsert > 0) {
|
|
1104
|
+
if (resultEnd + numCharsToInsert > bufferEnd) {
|
|
1105
|
+
folly::throw_exception<std::invalid_argument>("buffer too small");
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1108
|
+
std::optional<detail::ParsedDecimal::FractionalSuffix> fractionalsuffix =
|
|
1109
|
+
parsedDecimal.fractionalSuffix();
|
|
1110
|
+
if (fractionalsuffix.has_value()) {
|
|
1111
|
+
auto [fractionalSuffixBegin, fractionalSuffixEnd] = *fractionalsuffix;
|
|
1112
|
+
std::memmove(
|
|
1113
|
+
insertionPoint + numCharsToInsert,
|
|
1114
|
+
fractionalSuffixBegin,
|
|
1115
|
+
fractionalSuffixEnd - fractionalSuffixBegin);
|
|
1116
|
+
parsedDecimal.shiftFractionalSuffixPtrs(numCharsToInsert);
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1119
|
+
resultEnd += numCharsToInsert;
|
|
1120
|
+
}
|
|
1121
|
+
|
|
1122
|
+
if (insertDecimalPoint) {
|
|
1123
|
+
*insertionPoint++ = '.';
|
|
1124
|
+
}
|
|
1125
|
+
|
|
1126
|
+
while (numTrailingZerosToAdd) {
|
|
1127
|
+
*insertionPoint++ = '0';
|
|
1128
|
+
numTrailingZerosToAdd -= 1;
|
|
1129
|
+
}
|
|
1130
|
+
|
|
1131
|
+
if (parsedDecimal.exponentSymbol) {
|
|
1132
|
+
// std::tochars outputs a lowercase e and it needs to be uppercase.
|
|
1133
|
+
*parsedDecimal.exponentSymbol = 'E';
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
size_t charsToRemove = 0;
|
|
1137
|
+
char* removalBegin = nullptr;
|
|
1138
|
+
if (!flagsSet.emitPositiveExponentSign() && parsedDecimal.exponentSign &&
|
|
1139
|
+
*parsedDecimal.exponentSign == '+') {
|
|
1140
|
+
// std::to_chars outputs a + sign, remove it if the flag wasn't set.
|
|
1141
|
+
// e.g., 1.23e+45 -> 1.23e45
|
|
1142
|
+
removalBegin = parsedDecimal.exponentSign;
|
|
1143
|
+
charsToRemove += 1;
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1146
|
+
if (char* p = parsedDecimal.exponentBegin; p && *p == '0') {
|
|
1147
|
+
// std::to_chars outputs a leading zero, remove it to match
|
|
1148
|
+
// double_conversion formating. e.g., 1.23e+04 -> 1.23e4
|
|
1149
|
+
if (!removalBegin) {
|
|
1150
|
+
removalBegin = p;
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
while (p != parsedDecimal.exponentEnd && *p == '0') {
|
|
1154
|
+
charsToRemove += 1;
|
|
1155
|
+
p += 1;
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
if (p == parsedDecimal.exponentEnd) {
|
|
1159
|
+
// they all were 0 digits. keep a single 0.
|
|
1160
|
+
charsToRemove -= 1;
|
|
1161
|
+
p -= 1;
|
|
1162
|
+
if (p == removalBegin) {
|
|
1163
|
+
// there was only one 0, keep it.
|
|
1164
|
+
removalBegin = nullptr;
|
|
1165
|
+
}
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
if (charsToRemove && removalBegin) {
|
|
1170
|
+
size_t len = resultEnd - (removalBegin + charsToRemove);
|
|
1171
|
+
std::memmove(removalBegin, removalBegin + charsToRemove, len);
|
|
1172
|
+
resultEnd -= charsToRemove;
|
|
1173
|
+
}
|
|
1174
|
+
|
|
1175
|
+
return std::pair{resultBegin, resultEnd};
|
|
1176
|
+
}
|
|
1177
|
+
#endif // FOLLY_CONV_AVALIABILITY_TO_CHARS_FLOATING_POINT
|
|
1178
|
+
} // namespace detail
|
|
1179
|
+
|
|
1180
|
+
ConversionError makeConversionError(ConversionCode code, StringPiece input) {
|
|
1181
|
+
using namespace detail;
|
|
1182
|
+
static_assert(
|
|
1183
|
+
std::is_unsigned<std::underlying_type<ConversionCode>::type>::value,
|
|
1184
|
+
"ConversionCode should be unsigned");
|
|
1185
|
+
auto index = static_cast<std::size_t>(code);
|
|
1186
|
+
FOLLY_SAFE_CHECK(index < kErrorStrings.size(), "code=", uint64_t(index));
|
|
1187
|
+
const ErrorString& err = kErrorStrings[index];
|
|
1188
|
+
if (code == ConversionCode::EMPTY_INPUT_STRING && input.empty()) {
|
|
1189
|
+
return {err.string, code};
|
|
1190
|
+
}
|
|
1191
|
+
std::string tmp(err.string);
|
|
1192
|
+
tmp.append(": ");
|
|
1193
|
+
if (err.quote) {
|
|
1194
|
+
tmp.append(1, '"');
|
|
1195
|
+
}
|
|
1196
|
+
if (!input.empty()) {
|
|
1197
|
+
tmp.append(input.data(), input.size());
|
|
1198
|
+
}
|
|
1199
|
+
if (err.quote) {
|
|
1200
|
+
tmp.append(1, '"');
|
|
1201
|
+
}
|
|
1202
|
+
return {tmp, code};
|
|
1203
|
+
}
|
|
1204
|
+
|
|
1205
|
+
} // namespace folly
|