2 * Copyright 2007, Haiku Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
6 * Hugo Santos <hugosantos@gmail.com>
7 * Ingo Weinhold <bonefish@cs.tu-berlin.de>
16 Context::FormatSigned(int64 value
, int bytes
) const
23 snprintf(tmp
, sizeof(tmp
), "%" B_PRId64
, value
);
29 snprintf(tmp
, sizeof(tmp
), "0x%" B_PRIx64
, value
);
31 // Negative numbers are expanded when being converted to int64. Hence
32 // we skip all but the last 2 * bytes hex digits to retain the original
34 int len
= strlen(tmp
);
35 int offset
= len
- min_c(len
, bytes
* 2);
37 // use the existing "0x" prefix or prepend it again
49 Context::FormatUnsigned(uint64 value
) const
52 snprintf(tmp
, sizeof(tmp
), fDecimal
? "%" B_PRIu64
: "0x%" B_PRIx64
, value
);
57 Context::FormatFlags(uint64 value
) const
60 snprintf(tmp
, sizeof(tmp
), "0x%" B_PRIx64
, value
);
65 Context::FormatPointer(const void *address
) const
68 sprintf(buffer
, "%p", address
);