mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
This reimplements the underlying support for `Float16(_:StringSlice)`, `Float32(_:StringSlice)`, and `Float64(_:StringSlice)` in pure Swift, using the same core algorithm currently used by Apple's libc. Those `StringSlice` initializers are in turn used by `Float16(_:String)`, `Float32(_:String)`, and `Float64(_:String)`. **Supports Embedded**: This fully supports Embedded Swift and insulates us from variations in libc implementations. **Corrects bugs in Float16 parsing**: The previous version of `Float16` parsing called libc `strtof()` to parse to a 32-bit float, then rounded to `Float16`. (This was necessary because float16 parsing functions are not widely supported in C implementations.) This double-rounding systematically corrupted NaN payloads and resulted in 1 ULP errors for certain decimal and hexadecimal inputs. The new version parses `Float16` directly, avoiding these errors. **Modest perforamnce improvement**: The old version had to copy the Swift string to construct a C string. For inputs longer than 15 characters, this typically required a heap allocation, which added up to 20% to the runtime. The new version parses directly from a Swift string, avoiding this copy and heap allocation.
286 lines
6.9 KiB
JSON
286 lines
6.9 KiB
JSON
{
|
|
"Assert": [
|
|
"Assert.swift",
|
|
"AssertCommon.swift"
|
|
],
|
|
"String": [
|
|
"ASCII.swift",
|
|
"CString.swift",
|
|
"Character.swift",
|
|
"CharacterProperties.swift",
|
|
"NFC.swift",
|
|
"NFD.swift",
|
|
"SmallString.swift",
|
|
"StaticString.swift",
|
|
"String.swift",
|
|
"StringBreadcrumbs.swift",
|
|
"StringBridge.swift",
|
|
"StringCharacterView.swift",
|
|
"StringComparable.swift",
|
|
"StringComparison.swift",
|
|
"StringCreate.swift",
|
|
"StringObject.swift",
|
|
"StringGuts.swift",
|
|
"StringGutsSlice.swift",
|
|
"StringGraphemeBreaking.swift",
|
|
"StringHashable.swift",
|
|
"StringIndex.swift",
|
|
"StringIndexConversions.swift",
|
|
"StringIndexValidation.swift",
|
|
"StringInterpolation.swift",
|
|
"StringLegacy.swift",
|
|
"StringNormalization.swift",
|
|
"StringProtocol.swift",
|
|
"StringRangeReplaceableCollection.swift",
|
|
"StringGutsRangeReplaceable.swift",
|
|
"StringStorage.swift",
|
|
"StringStorageBridge.swift",
|
|
"StringSwitch.swift",
|
|
"StringTesting.swift",
|
|
"StringUTF16View.swift",
|
|
"StringUTF8View.swift",
|
|
"StringUTF8Validation.swift",
|
|
"StringUnicodeScalarView.swift",
|
|
"StringWordBreaking.swift",
|
|
"Substring.swift",
|
|
"Unicode.swift",
|
|
"UnicodeData.swift",
|
|
"UnicodeEncoding.swift",
|
|
"UnicodeBreakProperty.swift",
|
|
"UnicodeHelpers.swift",
|
|
"UnicodeParser.swift",
|
|
"UnicodeScalar.swift",
|
|
"UnicodeScalarProperties.swift",
|
|
"UnicodeSPI.swift",
|
|
"UnavailableStringAPIs.swift",
|
|
"UnmanagedOpaqueString.swift",
|
|
"UnmanagedString.swift",
|
|
"UTFEncoding.swift",
|
|
"UTF8.swift",
|
|
"UTF16.swift",
|
|
"UTF32.swift",
|
|
"ValidUTF8Buffer.swift"
|
|
],
|
|
"Bool": [
|
|
"Bool.swift"
|
|
],
|
|
"Collection": [
|
|
"Collection.swift",
|
|
"BidirectionalCollection.swift",
|
|
"RandomAccessCollection.swift",
|
|
"MutableCollection.swift",
|
|
"CollectionAlgorithms.swift",
|
|
"EmptyCollection.swift",
|
|
"Stride.swift",
|
|
"Repeat.swift",
|
|
"Sort.swift",
|
|
"Range.swift",
|
|
"ClosedRange.swift",
|
|
"RangeSet.swift",
|
|
"RangeSetRanges.swift",
|
|
"CollectionOfOne.swift",
|
|
"BridgingBuffer.swift",
|
|
"Sequence.swift",
|
|
"SequenceAlgorithms.swift",
|
|
"RangeReplaceableCollection.swift",
|
|
"Indices.swift",
|
|
"WriteBackMutableSlice.swift",
|
|
"UnfoldSequence.swift",
|
|
"UIntBuffer.swift",
|
|
"KeyValuePairs.swift",
|
|
"Diffing.swift",
|
|
"CollectionDifference.swift",
|
|
{
|
|
"Type-erased": [
|
|
"ExistentialCollection.swift"
|
|
],
|
|
"Lazy Views": [
|
|
"Algorithm.swift",
|
|
"EnumeratedSequence.swift",
|
|
"Flatten.swift",
|
|
"FlatMap.swift",
|
|
"Map.swift",
|
|
"Join.swift",
|
|
"Zip.swift",
|
|
"Filter.swift",
|
|
"Reverse.swift",
|
|
"Slice.swift",
|
|
"DiscontiguousSlice.swift",
|
|
"DropWhile.swift",
|
|
"PrefixWhile.swift",
|
|
"LazyCollection.swift",
|
|
"LazySequence.swift"],
|
|
"Array": [
|
|
"Array.swift",
|
|
"ArrayBody.swift",
|
|
"ArrayBuffer.swift",
|
|
"ArrayBufferProtocol.swift",
|
|
"ArrayCast.swift",
|
|
"ArrayType.swift",
|
|
"ArrayShared.swift",
|
|
"ArraySlice.swift",
|
|
"CocoaArray.swift",
|
|
"ContiguousArray.swift",
|
|
"ContiguousArrayBuffer.swift",
|
|
"ContiguouslyStored.swift",
|
|
"SliceBuffer.swift",
|
|
"SwiftNativeNSArray.swift"],
|
|
"HashedCollections": [
|
|
"HashTable.swift",
|
|
"Dictionary.swift",
|
|
"NativeDictionary.swift",
|
|
"DictionaryBridging.swift",
|
|
"DictionaryBuilder.swift",
|
|
"DictionaryCasting.swift",
|
|
"DictionaryStorage.swift",
|
|
"DictionaryVariant.swift",
|
|
"Set.swift",
|
|
"NativeSet.swift",
|
|
"SetAnyHashableExtensions.swift",
|
|
"SetBridging.swift",
|
|
"SetBuilder.swift",
|
|
"SetCasting.swift",
|
|
"SetStorage.swift",
|
|
"SetVariant.swift"
|
|
]
|
|
}
|
|
],
|
|
"C": [
|
|
"BridgeObjectiveC.swift",
|
|
"BridgeStorage.swift",
|
|
"Builtin.swift",
|
|
"VarArgs.swift",
|
|
"CTypes.swift",
|
|
"MemoryLayout.swift"
|
|
],
|
|
"KeyPaths": [
|
|
"KeyPath.swift"
|
|
],
|
|
"Reflection": [
|
|
"Dump.swift",
|
|
"Mirror.swift",
|
|
"Mirrors.swift",
|
|
"ReflectionMirror.swift",
|
|
"ObjectIdentifier.swift",
|
|
"ObjectIdentifier+DebugDescription.swift"
|
|
],
|
|
"Math": [
|
|
"SetAlgebra.swift",
|
|
"BuiltinMath.swift",
|
|
{
|
|
"Integers": [
|
|
"Int128.swift",
|
|
"Integers.swift",
|
|
"IntegerTypes.swift",
|
|
"IntegerParsing.swift",
|
|
"LegacyInt128.swift",
|
|
"StaticBigInt.swift",
|
|
"UInt128.swift"],
|
|
"Floating": [
|
|
"FloatingPoint.swift",
|
|
"FloatingPointFromString.swift",
|
|
"FloatingPointParsing.swift",
|
|
"FloatingPointToString.swift",
|
|
"FloatingPointTypes.swift",
|
|
"FloatingPointRandom.swift"],
|
|
"Vector": [
|
|
"SIMDIntegerConcreteOperations.swift",
|
|
"SIMDFloatConcreteOperations.swift",
|
|
"SIMDMaskConcreteOperations.swift",
|
|
"SIMDVector.swift",
|
|
"SIMDVectorTypes.swift"
|
|
]}
|
|
],
|
|
"Optional": [
|
|
"Optional.swift"
|
|
],
|
|
"Pointer": [
|
|
"Pointer.swift",
|
|
"SwiftifyImport.swift",
|
|
"TemporaryAllocation.swift",
|
|
"UnsafePointer.swift",
|
|
"UnsafeRawPointer.swift",
|
|
"UnsafeBufferPointer.swift",
|
|
"UnsafeBufferPointerSlice.swift",
|
|
"UnsafeRawBufferPointer.swift"
|
|
],
|
|
"Span": [
|
|
"MutableRawSpan.swift",
|
|
"MutableSpan.swift",
|
|
"OutputRawSpan.swift",
|
|
"OutputSpan.swift",
|
|
"RawSpan.swift",
|
|
"Span.swift"
|
|
],
|
|
"UTF8Span": [
|
|
"UTF8EncodingError.swift",
|
|
"UTF8Span.swift",
|
|
"UTF8SpanBits.swift",
|
|
"UTF8SpanComparisons.swift",
|
|
"UTF8SpanFundamentals.swift",
|
|
"UTF8SpanInternalHelpers.swift",
|
|
"UTF8SpanIterators.swift"
|
|
],
|
|
"Protocols": [
|
|
"CompilerProtocols.swift",
|
|
"ShadowProtocols.swift"
|
|
],
|
|
"Playground": [
|
|
"PlaygroundDisplay.swift"
|
|
],
|
|
"Hashing": [
|
|
"Hashable.swift",
|
|
"Hasher.swift",
|
|
"SipHash.swift",
|
|
"AnyHashable.swift",
|
|
"Hashing.swift",
|
|
"Bitset.swift"
|
|
],
|
|
"Misc": [
|
|
"AtomicInt.swift",
|
|
"Sendable.swift",
|
|
"ErrorType.swift",
|
|
"Identifiable.swift",
|
|
"InputStream.swift",
|
|
"LifetimeManager.swift",
|
|
"Macros.swift",
|
|
"ManagedBuffer.swift",
|
|
"Misc.swift",
|
|
"OptionSet.swift",
|
|
"OutputStream.swift",
|
|
"Policy.swift",
|
|
"Prespecialize.swift",
|
|
"Print.swift",
|
|
"REPL.swift",
|
|
"Random.swift",
|
|
"Runtime.swift",
|
|
"RuntimeFunctionCounters.swift",
|
|
"Shims.swift",
|
|
"StaticPrint.swift",
|
|
"ThreadLocalStorage.swift",
|
|
"Unmanaged.swift",
|
|
"Availability.swift",
|
|
"CommandLine.swift",
|
|
"Tuple.swift",
|
|
"NewtypeWrapper.swift",
|
|
"DebuggerSupport.swift",
|
|
"Equatable.swift",
|
|
"Comparable.swift",
|
|
"Codable.swift",
|
|
"LegacyABI.swift",
|
|
"MigrationSupport.swift",
|
|
"PtrAuth.swift",
|
|
"Duration.swift",
|
|
"DurationProtocol.swift",
|
|
"Instant.swift",
|
|
"EmbeddedRuntime.swift",
|
|
"EmbeddedStubs.swift",
|
|
"EmbeddedPrint.swift",
|
|
"InlineArray.swift",
|
|
"_InlineArray.swift"
|
|
],
|
|
"Result": [
|
|
"Result.swift"
|
|
]
|
|
}
|