mirror of
https://github.com/aljazceru/turso.git
synced 2026-02-23 00:45:37 +01:00
change compute_shl implementation to handle negation with overflow
This commit is contained in:
@@ -975,7 +975,15 @@ pub fn exec_shift_left(mut lhs: &OwnedValue, mut rhs: &OwnedValue) -> OwnedValue
|
||||
}
|
||||
|
||||
fn compute_shl(lhs: i64, rhs: i64) -> i64 {
|
||||
compute_shr(lhs, -rhs)
|
||||
if rhs == 0 {
|
||||
lhs
|
||||
} else if rhs >= 64 || rhs <= -64 {
|
||||
0
|
||||
} else if rhs > 0 {
|
||||
lhs << rhs
|
||||
} else {
|
||||
lhs >> -rhs
|
||||
}
|
||||
}
|
||||
|
||||
pub fn exec_shift_right(mut lhs: &OwnedValue, mut rhs: &OwnedValue) -> OwnedValue {
|
||||
|
||||
Reference in New Issue
Block a user