From: Peter Johnson Date: Mon, 23 Jan 2006 00:07:00 +0000 (-0000) Subject: * intnum.c (yasm_intnum_set_uint): New function to set intnum to any X-Git-Tag: v0.5.0rc1~41 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7a31b45af105d46dab1047878e6a8b55923761ff;p=yasm * intnum.c (yasm_intnum_set_uint): New function to set intnum to any arbitrary integer. (yasm_intnum_zero): Reimplement using yasm_intnum_set_uint. * intnum.h (yasm_intnum_set_uint): Prototype. svn path=/trunk/yasm/; revision=1339 --- diff --git a/libyasm/intnum.c b/libyasm/intnum.c index 3b594e3c..6544a86d 100644 --- a/libyasm/intnum.c +++ b/libyasm/intnum.c @@ -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 diff --git a/libyasm/intnum.h b/libyasm/intnum.h index ccda97be..645047e3 100644 --- a/libyasm/intnum.h +++ b/libyasm/intnum.h @@ -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.