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.
1 parent be0f333 commit 3e2ea94Copy full SHA for 3e2ea94
Sources/_JSONCore/Parser/JSONParser+Parsing.swift
@@ -325,10 +325,9 @@ extension JSONTokenizer {
325
326
// Compute hash of key bytes (excluding quotes)
327
// 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
+ // and ends just before `currentIndex` (which points to the closing quote).
330
var hash: UInt32 = 2166136261 // FNV offset basis
331
- for i in 1..<(keyLength + 1) {
+ for i in 1..<currentIndex {
332
hash ^= UInt32(self[i])
333
hash &*= 16777619 // FNV prime
334
}
0 commit comments