Fixup

Samuel Thibault samuel.thibault at ens-lyon.org
Sat Jul 1 05:14:53 PDT 2006


Hi,

Here is a fixup for 8bits cleanness: casting into _unsigned_ char is
needed for values greater than 127, because else the cast into long
expands the sign bit.

I also have an issue with modules/listfmts/nams/nasm-listfmt.c:220
because multiple might be 0, in which case we get a division by zero
here.

Samuel
-------------- next part --------------
Index: libyasm/intnum.c
===================================================================
--- libyasm/intnum.c	(r?vision 1590)
+++ libyasm/intnum.c	(copie de travail)
@@ -196,19 +196,19 @@
 
     switch (len) {
 	case 4:
-	    intn->val.ul |= (unsigned long)str[3];
+	    intn->val.ul |= (unsigned long)(unsigned char)str[3];
 	    intn->val.ul <<= 8;
 	    /*@fallthrough@*/
 	case 3:
-	    intn->val.ul |= (unsigned long)str[2];
+	    intn->val.ul |= (unsigned long)(unsigned char)str[2];
 	    intn->val.ul <<= 8;
 	    /*@fallthrough@*/
 	case 2:
-	    intn->val.ul |= (unsigned long)str[1];
+	    intn->val.ul |= (unsigned long)(unsigned char)str[1];
 	    intn->val.ul <<= 8;
 	    /*@fallthrough@*/
 	case 1:
-	    intn->val.ul |= (unsigned long)str[0];
+	    intn->val.ul |= (unsigned long)(unsigned char)str[0];
 	case 0:
 	    break;
 	default:


More information about the yasm-devel mailing list