right shift is now by default sign preserving (#11322)
* right shift is now by default sign preserving * fix hashString and semfold * enable arithmetic shift right globally for CI * fix typo * remove xxx * use oldShiftRight as flag * apply feedback * add changelog entry
This commit is contained in:
parent
897e7c90ac
commit
88b5dd3362
18 changed files with 211 additions and 187 deletions
|
|
@ -22,7 +22,7 @@ proc toVarNum(x: int32, b: var TBuffer) =
|
|||
a = abs(x)
|
||||
# first 6 bits:
|
||||
b[0] = toU8(ord(a >% 63'i32) shl 7 or (ord(x < 0'i32) shl 6) or (int(a) and 63))
|
||||
a = a shr 6'i32 # skip first 6 bits
|
||||
a = (a shr 6'i32) and 0x03ffffff # skip first 6 bits
|
||||
var i = 1
|
||||
while a != 0'i32:
|
||||
b[i] = toU8(ord(a >% 127'i32) shl 7 or (int(a) and 127))
|
||||
|
|
@ -42,7 +42,7 @@ proc toVarNum64(x: int64, b: var TBuffer) =
|
|||
a = abs(x)
|
||||
# first 6 bits:
|
||||
b[0] = toU8(ord(a >% 63'i64) shl 7 or (ord(x < 0'i64) shl 6) or int(a and 63))
|
||||
a = a shr 6 # skip first 6 bits
|
||||
a = (a shr 6) and 0x03ffffffffffffff # skip first 6 bits
|
||||
var i = 1
|
||||
while a != 0'i64:
|
||||
b[i] = toU8(ord(a >% 127'i64) shl 7 or int(a and 127))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue