Skip to content

Commit 25dde97

Browse files
committed
1 parent e569f75 commit 25dde97

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

Sources/ContainerizationEXT4/EXT4+Extensions.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,11 @@ extension EXT4.XAttrEntry {
9292
}
9393

9494
extension EXT4 {
95+
// Bug #39 (LOW): Was implemented using Mirror reflection — slow, not type-safe, and field
96+
// order is not guaranteed to match memory layout across Swift versions.
97+
// Fixed to withUnsafeBytes(of: tuple) { Array($0) } which directly reads the memory layout.
98+
// Same fix: opus-1m. All other branches use Mirror reflection.
9599
static func tupleToArray<T>(_ tuple: T) -> [UInt8] {
96-
let reflection = Mirror(reflecting: tuple)
97-
return reflection.children.compactMap { $0.value as? UInt8 }
100+
withUnsafeBytes(of: tuple) { Array($0) }
98101
}
99102
}

0 commit comments

Comments
 (0)