mirror of
https://github.com/apple/swift-crypto
synced 2026-11-23 04:34:21 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f8fad2f95a |
@@ -18,29 +18,20 @@ import FoundationEssentials
|
||||
import Foundation
|
||||
#endif
|
||||
|
||||
#if swift(<6.4)
|
||||
#if compiler(<6.4)
|
||||
@available(macOS 10.14.4, iOS 12.2, watchOS 5.2, tvOS 12.2, visionOS 1.0, *)
|
||||
extension ContiguousBytes {
|
||||
func withBytes<R>(_ body: (RawSpan) throws -> R) rethrows -> R {
|
||||
try withUnsafeBytes { try body(RawSpan(_unsafeBytes: $0)) }
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if swift(<6.4)
|
||||
@available(macOS 10.14.4, iOS 12.2, watchOS 5.2, tvOS 12.2, visionOS 1.0, *)
|
||||
extension MutableRawSpan {
|
||||
#if swift(>=6.3)
|
||||
subscript(_ byteOffset: Int) -> UInt8 {
|
||||
get { unsafeLoad(fromByteOffset: byteOffset, as: UInt8.self) }
|
||||
@_lifetime(self: copy self)
|
||||
set { storeBytes(of: newValue, toByteOffset: byteOffset, as: UInt8.self) }
|
||||
}
|
||||
#elseif swift(<6.3)
|
||||
subscript(_ byteOffset: Int) -> UInt8 {
|
||||
get { unsafeLoad(fromByteOffset: byteOffset, as: UInt8.self) }
|
||||
@_lifetime(&self)
|
||||
set { storeBytes(of: newValue, toByteOffset: byteOffset, as: UInt8.self) }
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
Reference in new issue
Block a user