We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b186a3b commit ff720f4Copy full SHA for ff720f4
Sources/ContainerizationEXT4/Integer+Extensions.swift
@@ -33,8 +33,12 @@ extension UInt64 {
33
lhs % UInt64(rhs)
34
}
35
36
+ // Bug #32 (MEDIUM): Original used (lhs / UInt64(rhs)).lo which silently discards the upper
37
+ // 32 bits; if the quotient exceeds UInt32.max the result is a wrong small value with no trap.
38
+ // Fixed to UInt32(lhs / UInt64(rhs)), which traps visibly on overflow.
39
+ // Same fix: sonnet. All other branches use .lo — silent truncation on large quotients.
40
public static func / (lhs: Self, rhs: UInt32) -> UInt32 {
- (lhs / UInt64(rhs)).lo
41
+ UInt32(lhs / UInt64(rhs))
42
43
44
public static func * (lhs: Self, rhs: UInt32) -> UInt64 {
0 commit comments