1
0
forked from aniani/vim

patch 8.2.5004: right shift on negative number does not work as documented

Problem:    Right shift on negative number does not work as documented.
Solution:   Use a uvarnumber_T type cast.
This commit is contained in:
Bram Moolenaar
2022-05-22 20:16:32 +01:00
parent a061f34191
commit 338bf58eba
7 changed files with 26 additions and 19 deletions

View File

@@ -1138,9 +1138,10 @@ expr6 >> expr6 bitwise right shift *expr->>*
*E1282* *E1283*
The "<<" and ">>" operators can be used to perform bitwise left or right shift
of the left operand by the number of bits specified by the right operand. The
operands must be positive numbers. The topmost bit (sign bit) is always
cleared for ">>". If the right operand (shift amount) is more than the
maximum number of bits in a number (|v:numbersize|) the result is zero.
operands are used as positive numbers. When shifting right with ">>" the
topmost bit (somtimes called the sign bit) is cleared. If the right operand
(shift amount) is more than the maximum number of bits in a number
(|v:numbersize|) the result is zero.
expr6 and expr7 *expr6* *expr7* *E1036* *E1051*
@@ -1417,6 +1418,10 @@ number number constant *expr-number*
Decimal, Hexadecimal (starting with 0x or 0X), Binary (starting with 0b or 0B)
and Octal (starting with 0, 0o or 0O).
Assuming 64 bit numbers are used (see |v:numbersize|) an unsigned number is
truncated to 0x7fffffffffffffff or 9223372036854775807. You can use -1 to get
0xffffffffffffffff.
*floating-point-format*
Floating point numbers can be written in two forms: