mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Issue #13088: Add shared Py_hexdigits constant to format a number into base 16
This commit is contained in:
parent
e506437b52
commit
f5cff56a1b
16 changed files with 118 additions and 135 deletions
|
@ -463,12 +463,11 @@ dump_decimal(int fd, int value)
|
|||
static void
|
||||
dump_hexadecimal(int width, unsigned long value, int fd)
|
||||
{
|
||||
const char *hexdigits = "0123456789abcdef";
|
||||
int len;
|
||||
char buffer[sizeof(unsigned long) * 2 + 1];
|
||||
len = 0;
|
||||
do {
|
||||
buffer[len] = hexdigits[value & 15];
|
||||
buffer[len] = Py_hexdigits[value & 15];
|
||||
value >>= 4;
|
||||
len++;
|
||||
} while (len < width || value);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue