Fix typographical errors (#5171)
Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com>
This commit is contained in:
@ -58,10 +58,10 @@ library SignedMath {
|
||||
// Since `n` is a signed integer, the generated bytecode will use the SAR opcode to perform the right shift,
|
||||
// taking advantage of the most significant (or "sign" bit) in two's complement representation.
|
||||
// This opcode adds new most significant bits set to the value of the previous most significant bit. As a result,
|
||||
// the mask will either be `bytes(0)` (if n is positive) or `~bytes32(0)` (if n is negative).
|
||||
// the mask will either be `bytes32(0)` (if n is positive) or `~bytes32(0)` (if n is negative).
|
||||
int256 mask = n >> 255;
|
||||
|
||||
// A `bytes(0)` mask leaves the input unchanged, while a `~bytes32(0)` mask complements it.
|
||||
// A `bytes32(0)` mask leaves the input unchanged, while a `~bytes32(0)` mask complements it.
|
||||
return uint256((n + mask) ^ mask);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user