]> granicus.if.org Git - yasm/commitdiff
* intnum.c (yasm_intnum_set_uint): New function to set intnum to any
authorPeter Johnson <peter@tortall.net>
Mon, 23 Jan 2006 00:07:00 +0000 (00:07 -0000)
committerPeter Johnson <peter@tortall.net>
Mon, 23 Jan 2006 00:07:00 +0000 (00:07 -0000)
arbitrary integer.
(yasm_intnum_zero): Reimplement using yasm_intnum_set_uint.
* intnum.h (yasm_intnum_set_uint): Prototype.

svn path=/trunk/yasm/; revision=1339

libyasm/intnum.c
libyasm/intnum.h

index 3b594e3c90d988e7eb7f03869b30f8559d788083..6544a86d0dfc457663b738a248ce5133e564de20 100644 (file)
@@ -451,12 +451,18 @@ yasm_intnum_calc(yasm_intnum *acc, yasm_expr_op op, yasm_intnum *operand,
 
 void
 yasm_intnum_zero(yasm_intnum *intn)
+{
+    yasm_intnum_set_uint(intn, 0);
+}
+
+void
+yasm_intnum_set_uint(yasm_intnum *intn, unsigned long val)
 {
     if (intn->type == INTNUM_BV) {
        BitVector_Destroy(intn->val.bv);
        intn->type = INTNUM_UL;
     }
-    intn->val.ul = 0;
+    intn->val.ul = val;
 }
 
 int
index ccda97beaef17ccf7909d2a1595e6d3ee4011bc4..645047e3036495f3c037db371667407dd7c217c0 100644 (file)
@@ -117,6 +117,12 @@ void yasm_intnum_calc(yasm_intnum *acc, yasm_expr_op op, yasm_intnum *operand,
  */
 void yasm_intnum_zero(yasm_intnum *intn);
 
+/** Set an intnum to an unsigned integer.
+ * \param intn     intnum
+ * \param val      integer value
+ */
+void yasm_intnum_set_uint(yasm_intnum *intn, unsigned long val);
+
 /** Simple value check for 0.
  * \param acc      intnum
  * \return Nonzero if acc==0.