Skip to content

Commit

Permalink
fix #5
Browse files Browse the repository at this point in the history
  • Loading branch information
hlorenzi committed Sep 16, 2018
1 parent 5e31feb commit e1e4c4e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "customasm"
version = "0.9.1"
version = "0.9.2"
authors = ["Henrique Lorenzi <[email protected]>"]

[lib]
Expand Down
4 changes: 2 additions & 2 deletions src/expr/eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -384,10 +384,10 @@ where F: Fn(u8, u8) -> u8
let mut rhs_bytes = rhs.to_signed_bytes_le();
let mut rhs_sign = rhs.sign();

if lhs_sign != Sign::Minus && (lhs_bytes[0] & 0x80) != 0
if lhs_sign != Sign::Minus
{ lhs_bytes.push(0); }

if rhs_sign != Sign::Minus && (rhs_bytes[0] & 0x80) != 0
if rhs_sign != Sign::Minus
{ rhs_bytes.push(0); }

if rhs_bytes.len() > lhs_bytes.len()
Expand Down
4 changes: 4 additions & 0 deletions src/test/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,10 @@ fn test_ops_concat()
test("4'0x0 @ 4'0x0 @ 4'0x8 @ 4'0x9", Pass(ExpressionValue::Integer(BigInt::from(0x89))));
test("0x1 @ (4'0x0 @ 4'0x0 @ 4'0x8 @ 4'0x9)", Pass(ExpressionValue::Integer(BigInt::from(0x10089))));

test("0x0 @ 0x8000[19:0]", Pass(ExpressionValue::Integer(BigInt::from(0x8000))));
test("0x1 @ 0x8000[19:0]", Pass(ExpressionValue::Integer(BigInt::from(0x108000))));
test("0x1 @ 0x9000[19:0]", Pass(ExpressionValue::Integer(BigInt::from(0x109000))));

test(" 0 @ 0", Fail(("test", 1, "known width")));
test("8'0 @ 0", Fail(("test", 1, "known width")));
test(" 0 @ 8'0", Fail(("test", 1, "known width")));
Expand Down
Binary file modified webasm/customasm.gc.wasm
Binary file not shown.

0 comments on commit e1e4c4e

Please sign in to comment.