mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Merge pull request #85544 from tbkka/tbkka-Issue85539
Properly initialize buffer when called via legacy ABI
This commit is contained in:
@@ -157,6 +157,9 @@ public func _float16ToStringImpl(
|
||||
var buffer = unsafe MutableSpan<UTF8.CodeUnit>(
|
||||
_unchecked: textBuffer,
|
||||
count: Int(bufferLength))
|
||||
for i in 0..<Int(bufferLength) {
|
||||
buffer[unchecked: i] = 0x30
|
||||
}
|
||||
let textRange = _Float16ToASCII(value: value, buffer: &buffer)
|
||||
let textLength = textRange.upperBound - textRange.lowerBound
|
||||
|
||||
@@ -446,6 +449,9 @@ internal func _float32ToStringImpl(
|
||||
var buffer = unsafe MutableSpan<UTF8.CodeUnit>(
|
||||
_unchecked: textBuffer,
|
||||
count: Int(bufferLength))
|
||||
for i in 0..<Int(bufferLength) {
|
||||
buffer[unchecked: i] = 0x30
|
||||
}
|
||||
let textRange = _Float32ToASCII(value: value, buffer: &buffer)
|
||||
let textLength = textRange.upperBound - textRange.lowerBound
|
||||
|
||||
@@ -694,6 +700,9 @@ internal func _float64ToStringImpl(
|
||||
var buffer = unsafe MutableSpan<UTF8.CodeUnit>(
|
||||
_unchecked: textBuffer,
|
||||
count: Int(bufferLength))
|
||||
for i in 0..<Int(bufferLength) {
|
||||
buffer[unchecked: i] = 0x30
|
||||
}
|
||||
let textRange = _Float64ToASCII(value: value, buffer: &buffer)
|
||||
let textLength = textRange.upperBound - textRange.lowerBound
|
||||
|
||||
@@ -1197,6 +1206,9 @@ internal func _float80ToStringImpl(
|
||||
var buffer = unsafe MutableSpan<UTF8.CodeUnit>(
|
||||
_unchecked: textBuffer,
|
||||
count: Int(bufferLength))
|
||||
for i in 0..<Int(bufferLength) {
|
||||
buffer[unchecked: i] = 0x30
|
||||
}
|
||||
let textRange = _Float80ToASCII(value: value, buffer: &buffer)
|
||||
let textLength = textRange.upperBound - textRange.lowerBound
|
||||
|
||||
|
||||
Reference in New Issue
Block a user