diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-05-22 20:16:32 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-05-22 20:16:32 +0100 |
commit | 338bf58eba758585ffef3fdfdba7d48477aacb7c (patch) | |
tree | 5ae6ce8b90f6aaaa06eb6d2192c9102c59fdd3b1 /runtime/doc/eval.txt | |
parent | a061f34191712df7dde7716705fe0ec074e9758e (diff) |
patch 8.2.5004: right shift on negative number does not work as documentedv8.2.5004
Problem: Right shift on negative number does not work as documented.
Solution: Use a uvarnumber_T type cast.
Diffstat (limited to 'runtime/doc/eval.txt')
-rw-r--r-- | runtime/doc/eval.txt | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index f9443fd297..77822d7963 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -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: |