1 /* Internal function for converting integers to ASCII.
2 Copyright (C) 1994,95,96,97,98,99,2002,2003 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
22 #include <sys/cdefs.h>
24 /* Convert VALUE into ASCII in base BASE (2..36).
25 Write backwards starting the character just before BUFLIM.
26 Return the address of the first (left-to-right) character in the number.
27 Use upper case letters iff UPPER_CASE is nonzero. */
29 extern char *_itoa (unsigned long long int value
, char *buflim
,
30 unsigned int base
, int upper_case
);
32 extern const char _itoa_upper_digits
[];
33 extern const char _itoa_upper_digits_internal
[] attribute_hidden
;
34 extern const char _itoa_lower_digits
[];
35 extern const char _itoa_lower_digits_internal
[] attribute_hidden
;
38 extern char *_itoa_word (unsigned long value
, char *buflim
,
39 unsigned int base
, int upper_case
);
41 static inline char * __attribute__ ((unused
, always_inline
))
42 _itoa_word (unsigned long value
, char *buflim
,
43 unsigned int base
, int upper_case
)
45 const char *digits
= (upper_case
46 # if defined IS_IN_rtld
47 ? INTUSE(_itoa_upper_digits
)
48 : INTUSE(_itoa_lower_digits
)
57 # define SPECIAL(Base) \
60 *--buflim = digits[value % Base]; \
61 while ((value /= Base) != 0); \
69 *--buflim
= digits
[value
% base
];
70 while ((value
/= base
) != 0);
77 /* Similar to the _itoa functions, but output starts at buf and pointer
78 after the last written character is returned. */
79 extern char *_fitoa_word (unsigned long value
, char *buf
, unsigned int base
,
80 int upper_case
) attribute_hidden
;
81 extern char *_fitoa (unsigned long long value
, char *buf
, unsigned int base
,
82 int upper_case
) attribute_hidden
;