]> granicus.if.org Git - yasm/commitdiff
Use intnum_tobv() in a couple more places.
authorPeter Johnson <peter@tortall.net>
Thu, 26 Jul 2007 07:36:05 +0000 (07:36 -0000)
committerPeter Johnson <peter@tortall.net>
Thu, 26 Jul 2007 07:36:05 +0000 (07:36 -0000)
svn path=/trunk/yasm/; revision=1901

libyasm/intnum.c

index ef29893f28afc3d785bff744134375dfb5c86863..5fc177b18b21cf69d71059523c5b40547de74575 100644 (file)
@@ -712,18 +712,7 @@ yasm_intnum_get_sized(const yasm_intnum *intn, unsigned char *ptr,
         BitVector_Block_Store(op1, ptr, (N_int)destsize);
 
     /* If not already a bitvect, convert value to be written to a bitvect */
-    if (intn->type == INTNUM_BV)
-        op2 = intn->val.bv;
-    else {
-        op2 = op2static;
-        BitVector_Empty(op2);
-        if (intn->val.l < 0) {
-            BitVector_Chunk_Store(op2, 32, 0, (unsigned long)-intn->val.l);
-            BitVector_Negate(op2, op2);
-        } else {
-            BitVector_Chunk_Store(op2, 32, 0, (unsigned long)intn->val.l);
-        }
-    }
+    op2 = intnum_tobv(op2static, intn);
 
     /* Check low bits if right shifting and warnings enabled */
     if (warn && rshift > 0) {
@@ -769,16 +758,8 @@ yasm_intnum_check_size(const yasm_intnum *intn, size_t size, size_t rshift,
             BitVector_Copy(val, intn->val.bv);
         } else
             val = intn->val.bv;
-    } else {
-        val = conv_bv;
-        BitVector_Empty(val);
-        if (intn->val.l < 0) {
-            BitVector_Chunk_Store(val, 32, 0, (unsigned long)-intn->val.l);
-            BitVector_Negate(val, val);
-        } else {
-            BitVector_Chunk_Store(val, 32, 0, (unsigned long)intn->val.l);
-        }
-    }
+    } else
+        val = intnum_tobv(conv_bv, intn);
 
     if (size >= BITVECT_NATIVE_SIZE)
         return 1;