Skip to content

Commit bb2cb06

Browse files
committed
[stdlib] Eliminate more overflow checks
This is a tiny code size improvement.
1 parent 84d8ced commit bb2cb06

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

stdlib/public/core/HashTable.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ extension _HashTable {
392392
}
393393
var wrap = false
394394
while true {
395-
word += 1
395+
word &+= 1
396396
if word == wordCount {
397397
_precondition(!wrap, "Hash table has no holes")
398398
wrap = true

stdlib/public/core/NativeDictionary.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ extension _NativeDictionary { // Insertions
426426
let bucket = hashTable.insertNew(hashValue: hashValue)
427427
uncheckedInitialize(at: bucket, toKey: key, value: value)
428428
}
429-
_storage._count += 1
429+
_storage._count &+= 1
430430
}
431431

432432
/// Insert a new entry into uniquely held storage.

stdlib/public/core/NativeSet.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ extension _NativeSet { // Insertions
360360
let bucket = hashTable.insertNew(hashValue: hashValue)
361361
uncheckedInitialize(at: bucket, to: element)
362362
}
363-
_storage._count += 1
363+
_storage._count &+= 1
364364
}
365365

366366
/// Insert a new element into uniquely held storage.

0 commit comments

Comments
 (0)