From: Peter Johnson Date: Fri, 21 Sep 2007 17:48:17 +0000 (-0000) Subject: Fix #115: 1<<0 resulted in 0 instead of 1 (broken in [1900]). X-Git-Tag: v0.6.2~3^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bd7c26d2a629330b51d2e6594c5f96063836436f;p=yasm Fix #115: 1<<0 resulted in 0 instead of 1 (broken in [1900]). svn path=/trunk/yasm/; revision=1979 --- diff --git a/libyasm/intnum.c b/libyasm/intnum.c index 5fc177b1..2820fa2e 100644 --- a/libyasm/intnum.c +++ b/libyasm/intnum.c @@ -462,14 +462,14 @@ yasm_intnum_calc(yasm_intnum *acc, yasm_expr_op op, yasm_intnum *operand) Set_Complement(result, result); break; case YASM_EXPR_SHL: - if (operand->type == INTNUM_L && operand->val.l > 0) { + if (operand->type == INTNUM_L && operand->val.l >= 0) { BitVector_Copy(result, op1); BitVector_Move_Left(result, (N_int)operand->val.l); } else /* don't even bother, just zero result */ BitVector_Empty(result); break; case YASM_EXPR_SHR: - if (operand->type == INTNUM_L && operand->val.l > 0) { + if (operand->type == INTNUM_L && operand->val.l >= 0) { BitVector_Copy(result, op1); carry = BitVector_msb_(op1); count = (N_int)operand->val.l; diff --git a/libyasm/tests/Makefile.inc b/libyasm/tests/Makefile.inc index 1528ef68..e0e3d951 100644 --- a/libyasm/tests/Makefile.inc +++ b/libyasm/tests/Makefile.inc @@ -9,6 +9,8 @@ TESTS += uncstring_test TESTS += libyasm/tests/libyasm_test.sh EXTRA_DIST += libyasm/tests/libyasm_test.sh +EXTRA_DIST += libyasm/tests/1shl0.asm +EXTRA_DIST += libyasm/tests/1shl0.hex EXTRA_DIST += libyasm/tests/absloop-err.asm EXTRA_DIST += libyasm/tests/absloop-err.errwarn EXTRA_DIST += libyasm/tests/charconst64.asm