diff options
Diffstat (limited to 'ldso/ldso/ld_string.h')
-rw-r--r-- | ldso/ldso/ld_string.h | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/ldso/ldso/ld_string.h b/ldso/ldso/ld_string.h index 98f2dab81..5d18bb788 100644 --- a/ldso/ldso/ld_string.h +++ b/ldso/ldso/ld_string.h @@ -111,7 +111,7 @@ extern inline void * _dl_memset(void * str,int c,size_t len) /* Early on, we can't call printf, so use this to print out * numbers using the SEND_STDERR() macro */ -static inline char *_dl_simple_itol(unsigned long i) +static inline char *_dl_simple_ltoa(unsigned long i) { /* 21 digits plus null terminator, good for 64-bit or smaller ints */ static char local[22]; @@ -124,5 +124,24 @@ static inline char *_dl_simple_itol(unsigned long i) return p + 1; } +static inline char *_dl_simple_ltoahex(unsigned long i) +{ + /* 21 digits plus null terminator, good for 64-bit or smaller ints */ + static char local[22]; + char *p = &local[21]; + *p-- = '\0'; + do { + char temp = i % 0x10; + if (temp <= 0x09) + *p-- = '0' + temp; + else + *p-- = 'a' - 0x0a + temp; + i /= 0x10; + } while (i > 0); + *p-- = 'x'; + *p-- = '0'; + return p + 1; +} + #endif |