2009-12-15 00:32:23 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* include/stdint.h
|
|
|
|
*
|
2021-02-03 11:33:49 +01:00
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
|
|
* this work for additional information regarding copyright ownership. The
|
|
|
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
|
|
* "License"); you may not use this file except in compliance with the
|
|
|
|
* License. You may obtain a copy of the License at
|
2009-12-15 00:32:23 +01:00
|
|
|
*
|
2021-02-03 11:33:49 +01:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2009-12-15 00:32:23 +01:00
|
|
|
*
|
2021-02-03 11:33:49 +01:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
* License for the specific language governing permissions and limitations
|
|
|
|
* under the License.
|
2009-12-15 00:32:23 +01:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __INCLUDE_STDINT_H
|
|
|
|
#define __INCLUDE_STDINT_H
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
|
|
|
|
2011-05-12 21:39:51 +02:00
|
|
|
#ifdef CONFIG_ARCH_STDINT_H
|
|
|
|
# include <arch/stdint.h>
|
2011-05-12 20:07:05 +02:00
|
|
|
#else
|
|
|
|
# include <nuttx/compiler.h>
|
|
|
|
# include <arch/types.h>
|
2020-06-09 20:24:49 +02:00
|
|
|
# include <arch/inttypes.h>
|
2011-05-12 20:07:05 +02:00
|
|
|
# include <limits.h>
|
2009-12-15 00:32:23 +01:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Pre-processor Definitions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/* Limits of exact-width integer types */
|
|
|
|
|
2014-12-08 18:44:52 +01:00
|
|
|
#define INT8_MIN (-INT8_MAX - 1)
|
2021-02-17 23:04:31 +01:00
|
|
|
#define INT8_MAX INT8_C(127)
|
|
|
|
#define UINT8_MAX UINT8_C(255)
|
2009-12-15 00:32:23 +01:00
|
|
|
|
2014-12-08 18:44:52 +01:00
|
|
|
#define INT16_MIN (-INT16_MAX - 1)
|
2021-02-17 23:04:31 +01:00
|
|
|
#define INT16_MAX INT16_C(32767)
|
|
|
|
#define UINT16_MAX UINT16_C(65535)
|
2009-12-15 00:32:23 +01:00
|
|
|
|
2011-03-02 15:43:28 +01:00
|
|
|
#ifdef __INT24_DEFINED
|
2014-12-08 18:44:52 +01:00
|
|
|
# define INT24_MIN (-INT24_MAX - 1)
|
2021-02-17 23:04:31 +01:00
|
|
|
# define INT24_MAX INT24_C(8388607)
|
|
|
|
# define UINT24_MAX UINT24_C(16777215)
|
2009-12-15 00:32:23 +01:00
|
|
|
#endif
|
|
|
|
|
2014-12-08 18:44:52 +01:00
|
|
|
#define INT32_MIN (-INT32_MAX - 1)
|
2021-02-17 23:04:31 +01:00
|
|
|
#define INT32_MAX INT32_C(2147483647)
|
|
|
|
#define UINT32_MAX UINT32_C(4294967295)
|
2009-12-15 00:32:23 +01:00
|
|
|
|
|
|
|
#ifdef __INT64_DEFINED
|
2021-02-17 23:04:31 +01:00
|
|
|
# define INT64_MIN (-INT64_MAX - 1)
|
|
|
|
# define INT64_MAX INT64_C(9223372036854775807)
|
|
|
|
# define UINT64_MAX UINT64_C(18446744073709551615)
|
2009-12-15 00:32:23 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Limits of minimum-width integer types */
|
|
|
|
|
2014-12-08 18:44:52 +01:00
|
|
|
#define INT_LEAST8_MIN INT8_MIN
|
|
|
|
#define INT_LEAST8_MAX INT8_MAX
|
|
|
|
#define UINT_LEAST8_MAX UINT8_MAX
|
2009-12-15 00:32:23 +01:00
|
|
|
|
2014-12-08 18:44:52 +01:00
|
|
|
#define INT_LEAST16_MIN INT16_MIN
|
|
|
|
#define INT_LEAST16_MAX INT16_MAX
|
|
|
|
#define UINT_LEAST16_MAX UINT16_MAX
|
2009-12-15 00:32:23 +01:00
|
|
|
|
2011-03-02 15:43:28 +01:00
|
|
|
#ifdef __INT24_DEFINED
|
2014-12-08 18:44:52 +01:00
|
|
|
# define INT_LEAST24_MIN INT24_MIN
|
|
|
|
# define INT_LEAST24_MAX INT24_MAX
|
|
|
|
# define UINT_LEAST24_MAX UINT24_MAX
|
2009-12-15 00:32:23 +01:00
|
|
|
#endif
|
|
|
|
|
2014-12-08 18:44:52 +01:00
|
|
|
#define INT_LEAST32_MIN INT32_MIN
|
|
|
|
#define INT_LEAST32_MAX INT32_MAX
|
|
|
|
#define UINT_LEAST32_MAX UINT32_MAX
|
2009-12-15 00:32:23 +01:00
|
|
|
|
|
|
|
#ifdef __INT64_DEFINED
|
2014-12-08 18:44:52 +01:00
|
|
|
# define INT_LEAST64_MIN INT64_MIN
|
|
|
|
# define INT_LEAST64_MAX INT64_MAX
|
|
|
|
# define UINT_LEAST64_MAX UINT64_MAX
|
2009-12-15 00:32:23 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Limits of fastest minimum-width integer types */
|
|
|
|
|
2014-12-08 18:44:52 +01:00
|
|
|
#define INT_FAST8_MIN INT8_MIN
|
|
|
|
#define INT_FAST8_MAX INT8_MAX
|
|
|
|
#define UINT_FAST8_MAX UINT8_MAX
|
2009-12-15 00:32:23 +01:00
|
|
|
|
2014-12-08 18:44:52 +01:00
|
|
|
#define INT_FAST16_MIN INT16_MIN
|
|
|
|
#define INT_FAST16_MAX INT16_MAX
|
|
|
|
#define UINT_FAST16_MAX UINT16_MAX
|
2009-12-15 00:32:23 +01:00
|
|
|
|
2011-03-02 15:43:28 +01:00
|
|
|
#ifdef __INT24_DEFINED
|
2014-12-08 18:44:52 +01:00
|
|
|
# define INT_FAST24_MIN INT24_MIN
|
|
|
|
# define INT_FAST24_MAX INT24_MAX
|
|
|
|
# define UINT_FAST24_MAX UINT24_MAX
|
2009-12-15 00:32:23 +01:00
|
|
|
#endif
|
|
|
|
|
2014-12-08 18:44:52 +01:00
|
|
|
#define INT_FAST32_MIN INT32_MIN
|
|
|
|
#define INT_FAST32_MAX INT32_MAX
|
|
|
|
#define UINT_FAST32_MAX UINT32_MAX
|
2009-12-15 00:32:23 +01:00
|
|
|
|
|
|
|
#ifdef __INT64_DEFINED
|
2014-12-08 18:44:52 +01:00
|
|
|
# define INT_FAST64_MIN INT64_MIN
|
|
|
|
# define INT_FAST64_MAX INT64_MAX
|
|
|
|
# define UINT_FAST64_MAX UINT64_MAX
|
2009-12-15 00:32:23 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Limits of integer types capable of holding object pointers */
|
|
|
|
|
|
|
|
#define INTPTR_MIN PTR_MIN
|
2020-02-07 11:18:25 +01:00
|
|
|
#define INTPTR_MAX PTR_MAX
|
2009-12-15 00:32:23 +01:00
|
|
|
#define UINTPTR_MAX UPTR_MAX
|
|
|
|
|
2022-10-02 12:36:27 +02:00
|
|
|
/* Limits of sig_atomic_t type */
|
|
|
|
|
|
|
|
#define SIG_ATOMIC_MIN INT32_MIN
|
|
|
|
#define SIG_ATOMIC_MAX INT32_MAX
|
|
|
|
|
2009-12-15 00:32:23 +01:00
|
|
|
/* Limits of greatest-width integer types */
|
|
|
|
|
|
|
|
#ifdef __INT64_DEFINED
|
|
|
|
# define INTMAX_MIN INT64_MIN
|
|
|
|
# define INTMAX_MAX INT64_MAX
|
|
|
|
|
|
|
|
# define UINTMAX_MIN UINT64_MIN
|
|
|
|
# define UINTMAX_MAX UINT64_MAX
|
2020-06-09 20:24:49 +02:00
|
|
|
|
|
|
|
# define INTMAX_C(x) INT64_C(x)
|
|
|
|
# define UINTMAX_C(x) UINT64_C(x)
|
2009-12-15 00:32:23 +01:00
|
|
|
#else
|
|
|
|
# define INTMAX_MIN INT32_MIN
|
|
|
|
# define INTMAX_MAX INT32_MAX
|
|
|
|
|
|
|
|
# define UINTMAX_MIN UINT32_MIN
|
|
|
|
# define UINTMAX_MAX UINT32_MAX
|
2014-12-08 18:44:52 +01:00
|
|
|
|
2020-06-09 20:24:49 +02:00
|
|
|
# define INTMAX_C(x) INT32_C(x)
|
|
|
|
# define UINTMAX_C(x) UINT32_C(x)
|
2009-12-15 00:32:23 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Public Types
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/* Exact-width integer types. NOTE that these types are defined in
|
|
|
|
* architecture-specific logic with leading underscore character. This file
|
|
|
|
* typedef's these to the final name without the underscore character. This
|
|
|
|
* roundabout way of doings things allows the stdint.h to be removed from the
|
2020-04-02 15:38:03 +02:00
|
|
|
* include/ directory in the event that the user prefers to use the
|
|
|
|
* definitions provided by their toolchain header files.
|
2009-12-15 00:32:23 +01:00
|
|
|
*/
|
|
|
|
|
2014-12-08 18:44:52 +01:00
|
|
|
typedef _int8_t int8_t;
|
|
|
|
typedef _uint8_t uint8_t;
|
2009-12-15 00:32:23 +01:00
|
|
|
|
2014-12-08 18:44:52 +01:00
|
|
|
typedef _int16_t int16_t;
|
|
|
|
typedef _uint16_t uint16_t;
|
2009-12-15 00:32:23 +01:00
|
|
|
|
|
|
|
#ifdef __INT24_DEFINED
|
2014-12-08 18:44:52 +01:00
|
|
|
typedef _int24_t int24_t;
|
|
|
|
typedef _uint24_t uint24_t;
|
2009-12-15 00:32:23 +01:00
|
|
|
#endif
|
|
|
|
|
2014-12-08 18:44:52 +01:00
|
|
|
typedef _int32_t int32_t;
|
|
|
|
typedef _uint32_t uint32_t;
|
2009-12-15 00:32:23 +01:00
|
|
|
|
|
|
|
#ifdef __INT64_DEFINED
|
2014-12-08 18:44:52 +01:00
|
|
|
typedef _int64_t int64_t;
|
|
|
|
typedef _uint64_t uint64_t;
|
2009-12-15 00:32:23 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Minimum-width integer types */
|
|
|
|
|
2014-12-08 18:44:52 +01:00
|
|
|
typedef _int8_t int_least8_t;
|
|
|
|
typedef _uint8_t uint_least8_t;
|
2009-12-15 00:32:23 +01:00
|
|
|
|
2014-12-08 18:44:52 +01:00
|
|
|
typedef _int16_t int_least16_t;
|
|
|
|
typedef _uint16_t uint_least16_t;
|
2009-12-15 00:32:23 +01:00
|
|
|
|
|
|
|
#ifdef __INT24_DEFINED
|
2014-12-08 18:44:52 +01:00
|
|
|
typedef _int24_t int_least24_t;
|
|
|
|
typedef _uint24_t uint_least24_t;
|
2009-12-15 00:32:23 +01:00
|
|
|
#else
|
2014-12-08 18:44:52 +01:00
|
|
|
typedef _int32_t int_least24_t;
|
|
|
|
typedef _uint32_t uint_least24_t;
|
2009-12-15 00:32:23 +01:00
|
|
|
#endif
|
|
|
|
|
2014-12-08 18:44:52 +01:00
|
|
|
typedef _int32_t int_least32_t;
|
|
|
|
typedef _uint32_t uint_least32_t;
|
2009-12-15 00:32:23 +01:00
|
|
|
|
|
|
|
#ifdef __INT64_DEFINED
|
2014-12-08 18:44:52 +01:00
|
|
|
typedef _int64_t int_least64_t;
|
|
|
|
typedef _uint64_t uint_least64_t;
|
2009-12-15 00:32:23 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Fastest minimum-width integer types */
|
|
|
|
|
2014-12-08 18:44:52 +01:00
|
|
|
typedef _int8_t int_fast8_t;
|
|
|
|
typedef _uint8_t uint_fast8_t;
|
2009-12-15 00:32:23 +01:00
|
|
|
|
2014-12-08 18:44:52 +01:00
|
|
|
typedef int int_fast16_t;
|
|
|
|
typedef unsigned int uint_fast16_t;
|
2009-12-15 00:32:23 +01:00
|
|
|
|
|
|
|
#ifdef __INT24_DEFINED
|
2014-12-08 18:44:52 +01:00
|
|
|
typedef _int24_t int_fast24_t;
|
|
|
|
typedef _uint24_t uint_fast24_t;
|
2009-12-15 00:32:23 +01:00
|
|
|
#else
|
2014-12-08 18:44:52 +01:00
|
|
|
typedef _int32_t int_fast24_t;
|
|
|
|
typedef _uint32_t uint_fast24_t;
|
2009-12-15 00:32:23 +01:00
|
|
|
#endif
|
|
|
|
|
2014-12-08 18:44:52 +01:00
|
|
|
typedef _int32_t int_fast32_t;
|
|
|
|
typedef _uint32_t uint_fast32_t;
|
2009-12-15 00:32:23 +01:00
|
|
|
|
|
|
|
#ifdef __INT64_DEFINED
|
2014-12-08 18:44:52 +01:00
|
|
|
typedef _int64_t int_fast64_t;
|
|
|
|
typedef _uint64_t uint_fast64_t;
|
2009-12-15 00:32:23 +01:00
|
|
|
#endif
|
|
|
|
|
2020-02-17 13:19:25 +01:00
|
|
|
/* Integer types capable of holding object pointers
|
|
|
|
* As a general rule, the size of size_t should be the same as the size of
|
|
|
|
* uintptr_t: 32-bits on a machine with 32-bit addressing but 64-bits on a
|
|
|
|
* machine with 64-bit addressing.
|
|
|
|
*/
|
2009-12-15 00:32:23 +01:00
|
|
|
|
2020-02-17 13:19:25 +01:00
|
|
|
typedef _ssize_t intptr_t;
|
|
|
|
typedef _size_t uintptr_t;
|
2009-12-15 00:32:23 +01:00
|
|
|
|
2011-07-01 21:08:04 +02:00
|
|
|
/* Some architectures support a FAR pointer which is larger then the normal
|
|
|
|
* (near) pointer
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef CONFIG_HAVE_FARPOINTER
|
2014-12-08 18:44:52 +01:00
|
|
|
typedef _int_farptr_t int_farptr_t;
|
|
|
|
typedef _uint_farptr_t uint_farptr_t;
|
2011-07-01 21:08:04 +02:00
|
|
|
#endif
|
|
|
|
|
2009-12-15 00:32:23 +01:00
|
|
|
/* Greatest-width integer types */
|
|
|
|
|
2020-11-05 06:50:02 +01:00
|
|
|
typedef _intmax_t intmax_t;
|
|
|
|
typedef _uintmax_t uintmax_t;
|
2009-12-15 00:32:23 +01:00
|
|
|
|
2020-06-02 06:49:54 +02:00
|
|
|
#endif /* CONFIG_ARCH_STDINT_H */
|
2009-12-15 00:32:23 +01:00
|
|
|
#endif /* __INCLUDE_STDINT_H */
|