Skip to content

Commit 3e2ea94

Browse files
JoannisCopilot
andauthored
Update Sources/_JSONCore/Parser/JSONParser+Parsing.swift
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent be0f333 commit 3e2ea94

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

Sources/_JSONCore/Parser/JSONParser+Parsing.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -325,10 +325,9 @@ extension JSONTokenizer {
325325

326326
// Compute hash of key bytes (excluding quotes)
327327
// Key content starts at offset 1 (after opening quote)
328-
// Key length is currentIndex - 1 (excluding opening quote, currentIndex points to closing quote)
329-
let keyLength = currentIndex - 1
328+
// and ends just before `currentIndex` (which points to the closing quote).
330329
var hash: UInt32 = 2166136261 // FNV offset basis
331-
for i in 1..<(keyLength + 1) {
330+
for i in 1..<currentIndex {
332331
hash ^= UInt32(self[i])
333332
hash &*= 16777619 // FNV prime
334333
}

0 commit comments

Comments
 (0)