diff options
author | Mike Frysinger <vapier@gentoo.org> | 2006-03-08 03:58:13 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2006-03-08 03:58:13 +0000 |
commit | f0d5c576f73efed254eaa77ad270afa6efe6026c (patch) | |
tree | 7a46da05a1c0500d06cbd54bc83987d280ea3ae2 /ldso/include | |
parent | 4bc11d6cf8d28c890dc029fa9318cc0d3b6e870b (diff) |
macro out the /10 operation so arches can have their own versions ... and create some default macros for do_rem/do_div_10 so we dont duplicate the samething in many arch header files
Diffstat (limited to 'ldso/include')
-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); \ } |