162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
262306a36Sopenharmony_ci#ifndef _UAPI__ASM_GENERIC_BITS_PER_LONG
362306a36Sopenharmony_ci#define _UAPI__ASM_GENERIC_BITS_PER_LONG
462306a36Sopenharmony_ci
562306a36Sopenharmony_ci#ifndef __BITS_PER_LONG
662306a36Sopenharmony_ci/*
762306a36Sopenharmony_ci * In order to keep safe and avoid regression, only unify uapi
862306a36Sopenharmony_ci * bitsperlong.h for some archs which are using newer toolchains
962306a36Sopenharmony_ci * that have the definitions of __CHAR_BIT__ and __SIZEOF_LONG__.
1062306a36Sopenharmony_ci * See the following link for more info:
1162306a36Sopenharmony_ci * https://lore.kernel.org/linux-arch/b9624545-2c80-49a1-ac3c-39264a591f7b@app.fastmail.com/
1262306a36Sopenharmony_ci */
1362306a36Sopenharmony_ci#if defined(__CHAR_BIT__) && defined(__SIZEOF_LONG__)
1462306a36Sopenharmony_ci#define __BITS_PER_LONG (__CHAR_BIT__ * __SIZEOF_LONG__)
1562306a36Sopenharmony_ci#else
1662306a36Sopenharmony_ci/*
1762306a36Sopenharmony_ci * There seems to be no way of detecting this automatically from user
1862306a36Sopenharmony_ci * space, so 64 bit architectures should override this in their
1962306a36Sopenharmony_ci * bitsperlong.h. In particular, an architecture that supports
2062306a36Sopenharmony_ci * both 32 and 64 bit user space must not rely on CONFIG_64BIT
2162306a36Sopenharmony_ci * to decide it, but rather check a compiler provided macro.
2262306a36Sopenharmony_ci */
2362306a36Sopenharmony_ci#define __BITS_PER_LONG 32
2462306a36Sopenharmony_ci#endif
2562306a36Sopenharmony_ci#endif
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ci#endif /* _UAPI__ASM_GENERIC_BITS_PER_LONG */
28