* nscd/selinux.c (audit_init): Print error string in the failure
[glibc.git] / stdio-common / _itoa.h
blob21a9c39294580b1c5083c5becb1df00e3f034281
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
18 02111-1307 USA. */
20 #ifndef _ITOA_H
21 #define _ITOA_H
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;
37 #ifndef NOT_IN_libc
38 extern char *_itoa_word (unsigned long value, char *buflim,
39 unsigned int base, int upper_case);
40 #else
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)
49 # else
50 ? _itoa_upper_digits
51 : _itoa_lower_digits
52 # endif
55 switch (base)
57 # define SPECIAL(Base) \
58 case Base: \
59 do \
60 *--buflim = digits[value % Base]; \
61 while ((value /= Base) != 0); \
62 break
64 SPECIAL (10);
65 SPECIAL (16);
66 SPECIAL (8);
67 default:
69 *--buflim = digits[value % base];
70 while ((value /= base) != 0);
72 return buflim;
74 # undef SPECIAL
75 #endif
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;
84 #endif /* itoa.h */