xref: /dflybsd-src/include/inttypes.h (revision cb8d7745a86ce76bf78c56aa80dbe39700e7b1be)
1e2565a42SMatthew Dillon /*-
2*cb8d7745SSascha Wildner  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3*cb8d7745SSascha Wildner  *
4e2565a42SMatthew Dillon  * Copyright (c) 2001 Mike Barcroft <mike@FreeBSD.org>
5e2565a42SMatthew Dillon  * All rights reserved.
6e2565a42SMatthew Dillon  *
7e2565a42SMatthew Dillon  * Redistribution and use in source and binary forms, with or without
8e2565a42SMatthew Dillon  * modification, are permitted provided that the following conditions
9e2565a42SMatthew Dillon  * are met:
10e2565a42SMatthew Dillon  * 1. Redistributions of source code must retain the above copyright
11e2565a42SMatthew Dillon  *    notice, this list of conditions and the following disclaimer.
12e2565a42SMatthew Dillon  * 2. Redistributions in binary form must reproduce the above copyright
13e2565a42SMatthew Dillon  *    notice, this list of conditions and the following disclaimer in the
14e2565a42SMatthew Dillon  *    documentation and/or other materials provided with the distribution.
15e2565a42SMatthew Dillon  *
16e2565a42SMatthew Dillon  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17e2565a42SMatthew Dillon  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18e2565a42SMatthew Dillon  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19e2565a42SMatthew Dillon  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20e2565a42SMatthew Dillon  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21e2565a42SMatthew Dillon  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22e2565a42SMatthew Dillon  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23e2565a42SMatthew Dillon  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24e2565a42SMatthew Dillon  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25e2565a42SMatthew Dillon  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26e2565a42SMatthew Dillon  * SUCH DAMAGE.
27e2565a42SMatthew Dillon  *
28*cb8d7745SSascha Wildner  * $FreeBSD: head/include/inttypes.h 326192 2017-11-25 17:09:43Z pfg $
29e2565a42SMatthew Dillon  */
30e2565a42SMatthew Dillon 
31e2565a42SMatthew Dillon #ifndef _INTTYPES_H_
32e2565a42SMatthew Dillon #define	_INTTYPES_H_
33e2565a42SMatthew Dillon 
34e2565a42SMatthew Dillon #include <machine/inttypes.h>
353cfdabcfSzrj #ifndef __cplusplus
363cfdabcfSzrj #include <machine/wchar.h>		/* for ___wchar_t */
373cfdabcfSzrj #endif
38e2565a42SMatthew Dillon #include <stdint.h>
39e2565a42SMatthew Dillon 
403e581a72SPeter Avalos #ifndef __cplusplus
413e581a72SPeter Avalos #ifndef _WCHAR_T_DECLARED
423e581a72SPeter Avalos #define	_WCHAR_T_DECLARED
433cfdabcfSzrj typedef ___wchar_t	wchar_t;
443e581a72SPeter Avalos #endif
453e581a72SPeter Avalos #endif
463e581a72SPeter Avalos 
47e2565a42SMatthew Dillon typedef struct {
48e2565a42SMatthew Dillon 	intmax_t	quot;		/* Quotient. */
49e2565a42SMatthew Dillon 	intmax_t	rem;		/* Remainder. */
50e2565a42SMatthew Dillon } imaxdiv_t;
51e2565a42SMatthew Dillon 
52e2565a42SMatthew Dillon __BEGIN_DECLS
5344aab0b9SSascha Wildner #ifdef _XLOCALE_H_
5444aab0b9SSascha Wildner #include <xlocale/_inttypes.h>
5544aab0b9SSascha Wildner #endif
56e2565a42SMatthew Dillon intmax_t	imaxabs(intmax_t) __pure2;
57e2565a42SMatthew Dillon imaxdiv_t	imaxdiv(intmax_t, intmax_t) __pure2;
58e2565a42SMatthew Dillon 
59e2565a42SMatthew Dillon intmax_t	strtoimax(const char * __restrict, char ** __restrict, int);
60e2565a42SMatthew Dillon uintmax_t	strtoumax(const char * __restrict, char ** __restrict, int);
613e581a72SPeter Avalos intmax_t	wcstoimax(const wchar_t * __restrict,
623e581a72SPeter Avalos 		    wchar_t ** __restrict, int);
633e581a72SPeter Avalos uintmax_t	wcstoumax(const wchar_t * __restrict,
643e581a72SPeter Avalos 		    wchar_t ** __restrict, int);
65e2565a42SMatthew Dillon __END_DECLS
66e2565a42SMatthew Dillon 
67e2565a42SMatthew Dillon #endif /* !_INTTYPES_H_ */
68