diff options
Diffstat (limited to 'ldso/include/dl-string.h')
-rw-r--r-- | ldso/include/dl-string.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/ldso/include/dl-string.h b/ldso/include/dl-string.h index ec098d2ca..a50cfd6b3 100644 --- a/ldso/include/dl-string.h +++ b/ldso/include/dl-string.h @@ -11,6 +11,14 @@ #include <dl-sysdep.h> /* for do_rem */ #include <features.h> +/* provide some sane defaults */ +#ifndef do_rem +# define do_rem(result, n, base) ((result) = (n) % (base)) +#endif +#ifndef do_div_10 +# define do_div_10(result, remain) ((result) /= 10) +#endif + static size_t _dl_strlen(const char * str); static char *_dl_strcat(char *dst, const char *src); static char * _dl_strcpy(char * dst,const char *src); @@ -234,7 +242,7 @@ static __always_inline char * _dl_simple_ltoa(char * local, unsigned long i) char temp; do_rem(temp, i, 10); *--p = '0' + temp; - i /= 10; + do_div_10(i, temp); } while (i > 0); return p; } @@ -324,7 +332,7 @@ static __always_inline char * _dl_simple_ltoahex(char * local, unsigned long i) do { \ do_rem(v, (X), 10); \ *--tmp2 = '0' + v; \ - (X) /= 10; \ + do_div_10((X), v); \ } while ((X) > 0); \ _dl_write(2, tmp2, tmp1 - tmp2 + sizeof(tmp) - 1); \ } |