u-boot/include/limits.h
Andrew Goodbody 99145eec2d x86: select CONFIG_64BIT for X86_64
Select CONFIG_64BIT so that we pass the -m64 option (instead of -m32) to
static analysis tools.
Introduce CONFIG_SPL_64BIT and select it for architectures other than
x86 with 64 bit builds. Do not select it for x86 builds as x86 uses
a 32 bit SPL.
Ensure that when limits are set they use CONFIG_64BIT for U-Boot
proper and CONFIG_SPL_64BIT for SPL. This is to allow for the 32 bit
SPL build used by x86.

Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
2024-12-31 10:58:30 -06:00

26 lines
595 B
C

/* SPDX-License-Identifier: GPL-2.0+ */
#ifndef _LIMITS_H
#define _LIMITS_H
#define INT_MAX 0x7fffffff
#define UINT_MAX 0xffffffffU
#define CHAR_BIT 8
#define UINT32_MAX 0xffffffffU
#define UINT64_MAX 0xffffffffffffffffULL
#if (defined(CONFIG_64BIT) && !defined(CONFIG_SPL_BUILD)) || \
(defined(CONFIG_SPL_64BIT) && defined(CONFIG_SPL_BUILD))
#define UINTPTR_MAX UINT64_MAX
#else
#define UINTPTR_MAX UINT32_MAX
#endif
#ifndef SIZE_MAX
#define SIZE_MAX UINTPTR_MAX
#endif
#ifndef SSIZE_MAX
#define SSIZE_MAX ((ssize_t)(SIZE_MAX >> 1))
#endif
#endif /* _LIMITS_H */