1 Mar 2006 11:06
Re: Printing bogus values in ne2000_asic_ioport_read()/ ne2000_receive()
carlo.andreoli <at> tiscali.it <carlo.andreoli <at> tiscali.it>
2006-03-01 10:06:44 GMT
2006-03-01 10:06:44 GMT
Regarding the bogus numbers occasionally printed, you can see that the
leading
ffs are printed when the character has its bit7 set to 1. This occurs
because in
printf("%02x ", s[i]);
the expected argument for %02x is an integer, and since the actual
argument is
a (signed) character, the compiler promotes it to an integer extending
the sign bit.
You can simply write instead
printf("%02x ", (unsigned char)s[i]);
and the problem should disappear, since in this case the promotion to
an integer
adds non-significative 0s that are ignored when printig
Carlo
----Messaggio originale----
Da: kumrao2003 <at> yahoo.com
Data: 25/02/2006 19.29
A: <qemu-devel <at> nongnu.org>
Ogg: [Qemu-devel] Printing bogus values in ne2000_asic_ioport_read()/
ne2000_receive()
Hi,
I am using QEMU in one of my research projects. I
landed in a problem where I see bogus numbers being
printed when I printed the packet/each word that is
received from ne2000.
(Continue reading)
RSS Feed