We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ae25dca commit fbbccdfCopy full SHA for fbbccdf
Sources/_CryptoExtras/AES/Nonces.swift
@@ -20,22 +20,22 @@ import Foundation
20
21
fileprivate struct ByteIterator<T>: IteratorProtocol {
22
var currentOffset = 0
23
- var pointer: UnsafeRawBufferPointer? = nil
+ var iterator: Array<UInt8>.Iterator? = nil
24
let length: Int
25
26
init(_ bytes: T) {
27
self.length = Mirror(reflecting: bytes).children.count
28
withUnsafeBytes(of: bytes) { pointer in
29
- self.pointer = pointer
+ self.iterator = Array(pointer).makeIterator()
30
}
31
32
33
@inlinable
34
public mutating func next() -> UInt8? {
35
- guard let pointer,
+ guard var iterator,
36
currentOffset < length else { return nil }
37
38
- let next = pointer.load(fromByteOffset: currentOffset, as: UInt8.self)
+ let next = iterator.next()
39
currentOffset += 1
40
return next
41
0 commit comments