We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
CaptureStructure.encode(to:)
1 parent bb5a67f commit f34686cCopy full SHA for f34686c
Sources/_MatchingEngine/Regex/Parse/CaptureStructure.swift
@@ -331,9 +331,10 @@ extension CaptureStructure {
331
assert(
332
buffer.count >=
333
MemoryLayout<SerializationVersion>.stride + MemoryLayout<Code>.stride)
334
- // Encode version.
335
- buffer.storeBytes(
336
- of: Self.currentSerializationVersion, as: SerializationVersion.self)
+ // Encode version (unaligned store).
+ withUnsafeBytes(of: Self.currentSerializationVersion) {
+ buffer.copyMemory(from: $0)
337
+ }
338
// Encode contents.
339
var offset = MemoryLayout<SerializationVersion>.stride
340
/// Appends a code to the buffer, advancing the offset to the next position.
0 commit comments