bonefish+mmlr:
Fix kernel printing of unsigned 64bit datatypes with the highest bit set. They would previously be converted to a signed type and were then handled wrongly. Use the sign flag to properly decide when to use casting to a singed type. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26473 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -148,7 +148,7 @@ sign_symbol(int flags, bool negative)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
number(char **_string, int32 *_bytesLeft, int64 num, uint32 base, int size,
|
number(char **_string, int32 *_bytesLeft, uint64 num, uint32 base, int size,
|
||||||
int precision, int flags)
|
int precision, int flags)
|
||||||
{
|
{
|
||||||
const char *digits = "0123456789abcdefghijklmnopqrstuvwxyz";
|
const char *digits = "0123456789abcdefghijklmnopqrstuvwxyz";
|
||||||
@@ -164,11 +164,14 @@ number(char **_string, int32 *_bytesLeft, int64 num, uint32 base, int size,
|
|||||||
|
|
||||||
c = (flags & ZEROPAD) ? '0' : ' ';
|
c = (flags & ZEROPAD) ? '0' : ' ';
|
||||||
|
|
||||||
sign = sign_symbol(flags, num < 0);
|
if (flags & SIGN) {
|
||||||
if (num < 0)
|
sign = sign_symbol(flags, (int64)num < 0);
|
||||||
num = -num;
|
if ((int64)num < 0)
|
||||||
if (sign)
|
num = -(int64)num;
|
||||||
size--;
|
if (sign)
|
||||||
|
size--;
|
||||||
|
} else
|
||||||
|
sign = 0;
|
||||||
|
|
||||||
if ((flags & SPECIAL) != 0) {
|
if ((flags & SPECIAL) != 0) {
|
||||||
if (base == 16)
|
if (base == 16)
|
||||||
@@ -181,7 +184,7 @@ number(char **_string, int32 *_bytesLeft, int64 num, uint32 base, int size,
|
|||||||
if (num == 0)
|
if (num == 0)
|
||||||
tmp[i++] = '0';
|
tmp[i++] = '0';
|
||||||
else while (num != 0)
|
else while (num != 0)
|
||||||
tmp[i++] = digits[do_div((uint64 *)&num, base)];
|
tmp[i++] = digits[do_div(&num, base)];
|
||||||
|
|
||||||
if (i > precision)
|
if (i > precision)
|
||||||
precision = i;
|
precision = i;
|
||||||
|
|||||||
Reference in New Issue
Block a user