]> granicus.if.org Git - yasm/commitdiff
Fix #115: 1<<0 resulted in 0 instead of 1 (broken in [1900]).
authorPeter Johnson <peter@tortall.net>
Fri, 21 Sep 2007 17:48:17 +0000 (17:48 -0000)
committerPeter Johnson <peter@tortall.net>
Fri, 21 Sep 2007 17:48:17 +0000 (17:48 -0000)
svn path=/trunk/yasm/; revision=1979

libyasm/intnum.c
libyasm/tests/Makefile.inc

index 5fc177b18b21cf69d71059523c5b40547de74575..2820fa2e219c08c8dc019d3b8cd1253bd30216cd 100644 (file)
@@ -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;
index 1528ef68fe4daefdf4f16ee0ae2397bff5c59e01..e0e3d951e8afa87d65ee378abc4f84df79ad633c 100644 (file)
@@ -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