]> granicus.if.org Git - yasm/commitdiff
* intnum.c (yasm_intnum_zero): New function to zero an existing intnum.
authorPeter Johnson <peter@tortall.net>
Mon, 11 Oct 2004 02:14:34 +0000 (02:14 -0000)
committerPeter Johnson <peter@tortall.net>
Mon, 11 Oct 2004 02:14:34 +0000 (02:14 -0000)
* intnum.h (yasm_intnum_zero): Add prototype for above.

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

libyasm/intnum.c
libyasm/intnum.h

index 64b7a3a682ce6ff54389dc1a0dbcd6df30d88091..bcda2e784c0890947083865323ea31065111b387 100644 (file)
@@ -445,6 +445,16 @@ yasm_intnum_calc(yasm_intnum *acc, yasm_expr_op op, yasm_intnum *operand,
 }
 /*@=nullderef =nullpass =branchstate@*/
 
+void
+yasm_intnum_zero(yasm_intnum *intn)
+{
+    if (intn->type == INTNUM_BV) {
+       BitVector_Destroy(intn->val.bv);
+       intn->type = INTNUM_UL;
+    }
+    intn->val.ul = 0;
+}
+
 int
 yasm_intnum_is_zero(yasm_intnum *intn)
 {
index 3a2bdf3414cdd5c54c740f81dfa936d5bfdf9d21..0929af74c910007a3ca30b9aa71de09b049c68b5 100644 (file)
@@ -112,6 +112,11 @@ void yasm_intnum_destroy(/*@only@*/ yasm_intnum *intn);
 void yasm_intnum_calc(yasm_intnum *acc, yasm_expr_op op, yasm_intnum *operand,
                      unsigned long line);
 
+/** Zero an intnum.
+ * \param intn     intnum
+ */
+void yasm_intnum_zero(yasm_intnum *intn);
+
 /** Simple value check for 0.
  * \param acc      intnum
  * \return Nonzero if acc==0.