Fixing BYTE instruction

This commit is contained in:
Tomusdrw 2016-01-15 19:48:51 +01:00
parent 7af4825b15
commit 46ecb16191
2 changed files with 3 additions and 2 deletions

View File

@ -837,8 +837,9 @@ impl Interpreter {
}, },
instructions::BYTE => { instructions::BYTE => {
let word = stack.pop_back(); let word = stack.pop_back();
let val = stack.pop_back();
let byte = if word < U256::from(32) { let byte = if word < U256::from(32) {
word >> (8 * (31 - word.low_u64() as usize)) (val >> (8 * (31 - word.low_u64() as usize))) & U256::from(0xff)
} else { } else {
U256::zero() U256::zero()
}; };

View File

@ -168,7 +168,7 @@ fn do_json_test_for(vm: &VMType, json_data: &[u8]) -> Vec<String> {
let json = Json::from_str(::std::str::from_utf8(json_data).unwrap()).expect("Json is invalid"); let json = Json::from_str(::std::str::from_utf8(json_data).unwrap()).expect("Json is invalid");
let mut failed = Vec::new(); let mut failed = Vec::new();
for (name, test) in json.as_object().unwrap() { for (name, test) in json.as_object().unwrap() {
// if name != "signextend_Overflow_dj42" { // if name != "byte0" {
// continue; // continue;
// } // }
println!("name: {:?}", name); println!("name: {:?}", name);