From b8e86b24e6f6bcf66121b063451bf1750ce7d8a7 Mon Sep 17 00:00:00 2001 From: ChJR Date: Fri, 16 Aug 2019 02:21:50 +0900 Subject: [PATCH] Change int.inner_xshift wrong match guard routine. --- vm/src/obj/objint.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vm/src/obj/objint.rs b/vm/src/obj/objint.rs index 9a2a892a3..2e2b3d898 100644 --- a/vm/src/obj/objint.rs +++ b/vm/src/obj/objint.rs @@ -172,8 +172,8 @@ fn inner_lshift(int1: &PyInt, int2: &PyInt, vm: &VirtualMachine) -> PyResult { // i2 failed `to_usize()` conversion match &int2.value { - v if v < &BigInt::zero() => Err(vm.new_value_error("negative shift count".to_string())), - v if v > &BigInt::from(usize::max_value()) => { + v if *v < BigInt::zero() => Err(vm.new_value_error("negative shift count".to_string())), + v if *v > BigInt::from(usize::max_value()) => { Err(vm.new_overflow_error("the number is too large to convert to int".to_string())) } _ => panic!("Failed converting {} to rust usize", int2.value), @@ -187,8 +187,8 @@ fn inner_rshift(int1: &PyInt, int2: &PyInt, vm: &VirtualMachine) -> PyResult { // i2 failed `to_usize()` conversion match &int2.value { - v if v < &BigInt::zero() => Err(vm.new_value_error("negative shift count".to_string())), - v if v > &BigInt::from(usize::max_value()) => { + v if *v < BigInt::zero() => Err(vm.new_value_error("negative shift count".to_string())), + v if *v > BigInt::from(usize::max_value()) => { Err(vm.new_overflow_error("the number is too large to convert to int".to_string())) } _ => panic!("Failed converting {} to rust usize", int2.value),