|
From: Freddy S. <fr...@du...> - 2008-04-25 14:17:46
|
Hello, On Thu, Apr 24, 2008 at 05:22:28PM +0200, Freddy Spierenburg wrote: > The attached patch does add this support. Unfortunately the yesterday patch featured a grave bug. I overlooked the _ulong variable. Hence my patch could not handle the MSB part of the long long, pretty pointless. In solving this bug I could take two directions. Make _ulong a long long or invent an extra _ulonglong. For performance reason I chose the last route. I think those few extra conditional jumps are worth not having to do 64-bit arithmetic on all integers, please correct me if I'm wrong. Or perhaps you all think I'm braindead anyway, trying to do 64-bit arithmetic on a simple 16-bit CPU. :) Next I stumbled upon a gcc problem. I got the error below, while compiling vuprintf.c: stdlib/vuprintf.c: In function `vuprintf': stdlib/vuprintf.c:605: internal error: Segmentation fault A little bit of investigation showed me the line below was causing the trouble: notlastdigit=(_ulonglong>=base); For some strange reason gcc has trouble comparing the long long variable _ulonglong to the base. Unfortunately I do not have the guts (yet) to dive into the gcc source. Does anybody have an idea what is going on? I changed the line into the line below and that works without trouble: notlastdigit=((_ulonglong>>32)>0)||((unsigned long)_ulonglong>=base); But the elegant department is probably raising an eyebrow or two. Anyway, please find attached a patch that this time correctly adds the long long support to the printf() family. Any comments are appreciated. -- $ cat ~/.signature Freddy Spierenburg <fr...@du...> http://freddy.snarl.nl/ GnuPG: 0x7941D1E1=C948 5851 26D2 FA5C 39F1 E588 6F17 FD5D 7941 D1E1 $ # Please read http://www.ietf.org/rfc/rfc2015.txt before complain! |