netinet/in.h: add IPPROTO_MH
[uclibc-ng.git] / libc / stdio / _store_inttype.c
blob7ecfe6ed02b7596687ae6b7fe180f60e747d60b3
1 /* Copyright (C) 2004 Manuel Novoa III <mjn3@codepoet.org>
3 * GNU Library General Public License (LGPL) version 2 or later.
5 * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details.
6 */
8 #include "_stdio.h"
9 #include <printf.h>
11 /* Right now, we assume intmax_t is either long or long long */
13 #ifdef INTMAX_MAX
15 #ifdef LLONG_MAX
17 #if INTMAX_MAX > LLONG_MAX
18 #error INTMAX_MAX > LLONG_MAX! The printf code needs to be updated!
19 #endif
21 #elif INTMAX_MAX > LONG_MAX
23 #error No LLONG_MAX and INTMAX_MAX > LONG_MAX! The printf code needs to be updated!
25 #endif /* LLONG_MAX */
27 #endif /* INTMAX_MAX */
29 /* We assume int may be short or long, but short and long are different. */
31 void _store_inttype(register void *dest, int desttype, uintmax_t val)
33 if (desttype == __PA_FLAG_CHAR) { /* assume char not int */
34 *((unsigned char *) dest) = val;
35 return;
37 #if defined(LLONG_MAX) && (INT_MAX != LLONG_MAX)
38 if (desttype == PA_FLAG_LONG_LONG) {
39 *((unsigned long long int *) dest) = val;
40 return;
42 #endif /* LLONG_MAX */
43 #if SHRT_MAX != INT_MAX
44 if (desttype == PA_FLAG_SHORT) {
45 *((unsigned short int *) dest) = val;
46 return;
48 #endif /* SHRT_MAX */
49 #if LONG_MAX != INT_MAX
50 if (desttype == PA_FLAG_LONG) {
51 *((unsigned long int *) dest) = val;
52 return;
54 #endif /* LONG_MAX */
56 *((unsigned int *) dest) = val;