[PATCH] print negative numbers correctly via vsprintf in arch/ppc64/boot/prom.c
Andreas Schwab
schwab at suse.de
Tue May 10 05:54:08 EST 2005
Olaf Hering <olh at suse.de> writes:
> @@ -367,9 +384,9 @@ static char * number(char * str, long nu
> c = (type & ZEROPAD) ? '0' : ' ';
> sign = 0;
> if (type & SIGN) {
> - if (num < 0) {
> + if ((signed long long)num < 0) {
> sign = '-';
> - num = -num;
> + num = - (signed long long)num;
The cast is still not needed. In 2's complement representation the
negation of a signed number and an unsigned number are the same operation.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab at suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
More information about the Linuxppc64-dev
mailing list