xref: /freebsd/sys/sys/stdint.h (revision 95ee2897)
10ac2d551SMike Barcroft /*-
24d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
3c4e20cadSPedro F. Giffuni  *
40ac2d551SMike Barcroft  * Copyright (c) 2001 Mike Barcroft <mike@FreeBSD.org>
50ac2d551SMike Barcroft  * All rights reserved.
60ac2d551SMike Barcroft  *
70ac2d551SMike Barcroft  * Redistribution and use in source and binary forms, with or without
80ac2d551SMike Barcroft  * modification, are permitted provided that the following conditions
90ac2d551SMike Barcroft  * are met:
100ac2d551SMike Barcroft  * 1. Redistributions of source code must retain the above copyright
110ac2d551SMike Barcroft  *    notice, this list of conditions and the following disclaimer.
120ac2d551SMike Barcroft  * 2. Redistributions in binary form must reproduce the above copyright
130ac2d551SMike Barcroft  *    notice, this list of conditions and the following disclaimer in the
140ac2d551SMike Barcroft  *    documentation and/or other materials provided with the distribution.
150ac2d551SMike Barcroft  *
160ac2d551SMike Barcroft  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
170ac2d551SMike Barcroft  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
180ac2d551SMike Barcroft  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
190ac2d551SMike Barcroft  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
200ac2d551SMike Barcroft  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
210ac2d551SMike Barcroft  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
220ac2d551SMike Barcroft  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
230ac2d551SMike Barcroft  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
240ac2d551SMike Barcroft  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
250ac2d551SMike Barcroft  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
260ac2d551SMike Barcroft  * SUCH DAMAGE.
270ac2d551SMike Barcroft  */
280ac2d551SMike Barcroft 
290ac2d551SMike Barcroft #ifndef _SYS_STDINT_H_
300ac2d551SMike Barcroft #define _SYS_STDINT_H_
310ac2d551SMike Barcroft 
320ac2d551SMike Barcroft #include <sys/cdefs.h>
33abbd8902SMike Barcroft #include <sys/_types.h>
340ac2d551SMike Barcroft 
3549545b38SMike Barcroft #include <machine/_stdint.h>
36b928a692SDavid E. O'Brien #include <sys/_stdint.h>
370ac2d551SMike Barcroft 
380ac2d551SMike Barcroft typedef	__int_least8_t		int_least8_t;
390ac2d551SMike Barcroft typedef	__int_least16_t		int_least16_t;
400ac2d551SMike Barcroft typedef	__int_least32_t		int_least32_t;
410ac2d551SMike Barcroft typedef	__int_least64_t		int_least64_t;
420ac2d551SMike Barcroft 
430ac2d551SMike Barcroft typedef	__uint_least8_t		uint_least8_t;
440ac2d551SMike Barcroft typedef	__uint_least16_t	uint_least16_t;
450ac2d551SMike Barcroft typedef	__uint_least32_t	uint_least32_t;
460ac2d551SMike Barcroft typedef	__uint_least64_t	uint_least64_t;
470ac2d551SMike Barcroft 
480ac2d551SMike Barcroft typedef	__int_fast8_t		int_fast8_t;
490ac2d551SMike Barcroft typedef	__int_fast16_t		int_fast16_t;
500ac2d551SMike Barcroft typedef	__int_fast32_t		int_fast32_t;
510ac2d551SMike Barcroft typedef	__int_fast64_t		int_fast64_t;
520ac2d551SMike Barcroft 
530ac2d551SMike Barcroft typedef	__uint_fast8_t		uint_fast8_t;
540ac2d551SMike Barcroft typedef	__uint_fast16_t		uint_fast16_t;
550ac2d551SMike Barcroft typedef	__uint_fast32_t		uint_fast32_t;
560ac2d551SMike Barcroft typedef	__uint_fast64_t		uint_fast64_t;
570ac2d551SMike Barcroft 
582ff02bffSDavid Chisnall /* GNU and Darwin define this and people seem to think it's portable */
592ff02bffSDavid Chisnall #if defined(UINTPTR_MAX) && defined(UINT64_MAX) && (UINTPTR_MAX == UINT64_MAX)
602ff02bffSDavid Chisnall #define	__WORDSIZE		64
612ff02bffSDavid Chisnall #else
622ff02bffSDavid Chisnall #define	__WORDSIZE		32
632ff02bffSDavid Chisnall #endif
642ff02bffSDavid Chisnall 
6574dc547eSAndrew Turner /* Limits of wchar_t. */
6674dc547eSAndrew Turner #define	WCHAR_MIN	__WCHAR_MIN
6774dc547eSAndrew Turner #define	WCHAR_MAX	__WCHAR_MAX
6874dc547eSAndrew Turner 
699851b340SKonstantin Belousov #if __EXT1_VISIBLE
709851b340SKonstantin Belousov /* ISO/IEC 9899:2011 K.3.4.4 */
719851b340SKonstantin Belousov #ifndef RSIZE_MAX
729851b340SKonstantin Belousov #define RSIZE_MAX (SIZE_MAX >> 1)
739851b340SKonstantin Belousov #endif
749851b340SKonstantin Belousov #endif /* __EXT1_VISIBLE */
759851b340SKonstantin Belousov 
760ac2d551SMike Barcroft #endif /* !_SYS_STDINT_H_ */
77