Skip to content

Commit 32ed8d4

Browse files
committed
clarify reasoning
1 parent 8637d7a commit 32ed8d4

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

text/0560-integer-overflow.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,12 @@ defined results today. The only change is that now a panic may result.
128128
- The operations `+`, `-`, `*`, can underflow and overflow. When checking is
129129
enabled this will panic. When checking is disabled this will two's complement
130130
wrap.
131-
- The operations `/`, `%` are nonsensical for the arguments `INT_MIN` and `-1`.
132-
When this occurs there is an unconditional panic.
133-
- Shift operations (`<<`, `>>`) can shift a value of width `N` by more
134-
than `N` bits. This is prevented by unconditionally masking the bits
135-
of the right-hand-side to wrap modulo `N`.
131+
- The operations `/`, `%` for the arguments `INT_MIN` and `-1`
132+
will unconditionally panic. This is unconditional for legacy reasons.
133+
- Shift operations (`<<`, `>>`) on a value of with `N` can be passed a shift value
134+
>= `N`. It is unclear what behaviour should result from this, so the shift value
135+
is unconditionally masked to be modulo `N` to ensure that the argument is always
136+
in range.
136137

137138
## Enabling overflow checking
138139

0 commit comments

Comments
 (0)