mirror of
https://github.com/apache/nuttx.git
synced 2026-05-25 09:45:55 +08:00
!compiler: drop CONFIG_HAVE_LONG_LONG and require long long support
Every compiler supported by NuttX provides the "long long" types,
so the CONFIG_HAVE_LONG_LONG indirection is no longer useful.
Remove the option from include/nuttx/compiler.h and treat
"long long" as unconditionally available across the OS.
In addition to deleting the guard itself, this commit unconditionally
enables the long-long flavored helpers that used to be gated behind
it:
- libs/libc/fixedmath: drop the soft-emulated b32/ub32 routines
in lib_fixedmath.c (-261 lines) and trim the matching
prototypes, Make.defs and CMakeLists.txt entries; keep only
the long-long backed implementations.
- include/sys/endian.h, include/strings.h, libs/libc/string
/lib_ffsll.c, lib_flsll.c: always expose the 64-bit byte-swap
and ffsll/flsll variants.
- libs/libm/libm/lib_llround{,f,l}.c: drop the empty stubs.
- libs/libc/stdlib (atoll, llabs, lldiv, strtoll/ull, rand48,
strtold), libs/libc/stream (libvsprintf, libvscanf,
libbsprintf, ultoa_invert), libs/libc/misc (crc64, crc64emac),
libs/libc/inttypes/strtoimax, libs/libc/lzf, libs/libc/libc.csv,
libs/libc/string (memset, vikmemcpy): remove the
#ifdef CONFIG_HAVE_LONG_LONG branches.
- include/{stddef.h,stdlib.h,fixedmath.h,sys/epoll.h,cxx/cstdlib,
nuttx/audio/audio.h,nuttx/crc64.h,nuttx/lib/math.h,
nuttx/lib/math32.h,nuttx/lib/stdbit.h}: same guard cleanup.
- drivers/note/note_driver.c, fs/spiffs/src/spiffs.h,
sched/irq/irq_procfs.c: drop their local guards as well.
- Documentation/applications/netutils/ntpclient/index.rst:
refresh the documentation snippet.
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
+26
-34
@@ -71,20 +71,18 @@
|
||||
((((uint32_t)(n)) & 0xff000000UL) >> 24))
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_HAVE_LONG_LONG
|
||||
# ifdef CONFIG_HAVE_BUILTIN_BSWAP64
|
||||
# define __swap_uint64(n) ((uint64_t)__builtin_bswap64(n))
|
||||
# else
|
||||
# define __swap_uint64(n) \
|
||||
(uint64_t)(((((uint64_t)(n)) & 0x00000000000000ffULL) << 56) | \
|
||||
((((uint64_t)(n)) & 0x000000000000ff00ULL) << 40) | \
|
||||
((((uint64_t)(n)) & 0x0000000000ff0000ULL) << 24) | \
|
||||
((((uint64_t)(n)) & 0x00000000ff000000ULL) << 8) | \
|
||||
((((uint64_t)(n)) & 0x000000ff00000000ULL) >> 8) | \
|
||||
((((uint64_t)(n)) & 0x0000ff0000000000ULL) >> 24) | \
|
||||
((((uint64_t)(n)) & 0x00ff000000000000ULL) >> 40) | \
|
||||
((((uint64_t)(n)) & 0xff00000000000000ULL) >> 56))
|
||||
# endif
|
||||
#ifdef CONFIG_HAVE_BUILTIN_BSWAP64
|
||||
# define __swap_uint64(n) ((uint64_t)__builtin_bswap64(n))
|
||||
#else
|
||||
# define __swap_uint64(n) \
|
||||
(uint64_t)(((((uint64_t)(n)) & 0x00000000000000ffULL) << 56) | \
|
||||
((((uint64_t)(n)) & 0x000000000000ff00ULL) << 40) | \
|
||||
((((uint64_t)(n)) & 0x0000000000ff0000ULL) << 24) | \
|
||||
((((uint64_t)(n)) & 0x00000000ff000000ULL) << 8) | \
|
||||
((((uint64_t)(n)) & 0x000000ff00000000ULL) >> 8) | \
|
||||
((((uint64_t)(n)) & 0x0000ff0000000000ULL) >> 24) | \
|
||||
((((uint64_t)(n)) & 0x00ff000000000000ULL) >> 40) | \
|
||||
((((uint64_t)(n)) & 0xff00000000000000ULL) >> 56))
|
||||
#endif
|
||||
|
||||
/* Endian-specific definitions */
|
||||
@@ -107,12 +105,10 @@
|
||||
# define be32toh(n) ((uint32_t)(n))
|
||||
# define le32toh(n) __swap_uint32(n)
|
||||
|
||||
# ifdef CONFIG_HAVE_LONG_LONG
|
||||
# define htobe64(n) ((uint64_t)(n))
|
||||
# define htole64(n) __swap_uint64(n)
|
||||
# define be64toh(n) ((uint64_t)(n))
|
||||
# define le64toh(n) __swap_uint64(n)
|
||||
# endif
|
||||
# define htobe64(n) ((uint64_t)(n))
|
||||
# define htole64(n) __swap_uint64(n)
|
||||
# define be64toh(n) ((uint64_t)(n))
|
||||
# define le64toh(n) __swap_uint64(n)
|
||||
|
||||
#else
|
||||
/* Little-endian byte order */
|
||||
@@ -132,12 +128,10 @@
|
||||
# define be32toh(n) __swap_uint32(n)
|
||||
# define le32toh(n) ((uint32_t)(n))
|
||||
|
||||
# ifdef CONFIG_HAVE_LONG_LONG
|
||||
# define htobe64(n) __swap_uint64(n)
|
||||
# define htole64(n) ((uint64_t)(n))
|
||||
# define be64toh(n) __swap_uint64(n)
|
||||
# define le64toh(n) ((uint64_t)(n))
|
||||
# endif
|
||||
# define htobe64(n) __swap_uint64(n)
|
||||
# define htole64(n) ((uint64_t)(n))
|
||||
# define be64toh(n) __swap_uint64(n)
|
||||
# define le64toh(n) ((uint64_t)(n))
|
||||
#endif
|
||||
|
||||
/* OpenBSD style */
|
||||
@@ -159,13 +153,11 @@
|
||||
#define lemtoh32(x) letoh32(*(FAR uint32_t *)(x))
|
||||
#define htolem32(x, v) (*(FAR uint32_t *)(x) = htole32(v))
|
||||
|
||||
#ifdef CONFIG_HAVE_LONG_LONG
|
||||
# define betoh64 be64toh
|
||||
# define letoh64 le64toh
|
||||
# define bemtoh64(x) betoh64(*(FAR uint64_t *)(x))
|
||||
# define htobem64(x, v) (*(FAR uint64_t *)(x) = htobe64(v))
|
||||
# define lemtoh64(x) letoh64(*(FAR uint64_t *)(x))
|
||||
# define htolem64(x, v) (*(FAR uint64_t *)(x) = htole64(v))
|
||||
#endif
|
||||
#define betoh64 be64toh
|
||||
#define letoh64 le64toh
|
||||
#define bemtoh64(x) betoh64(*(FAR uint64_t *)(x))
|
||||
#define htobem64(x, v) (*(FAR uint64_t *)(x) = htobe64(v))
|
||||
#define lemtoh64(x) letoh64(*(FAR uint64_t *)(x))
|
||||
#define htolem64(x, v) (*(FAR uint64_t *)(x) = htole64(v))
|
||||
|
||||
#endif /* __INCLUDE_SYS_ENDIAN_H */
|
||||
|
||||
@@ -102,9 +102,7 @@ union epoll_data
|
||||
FAR void *ptr;
|
||||
int fd;
|
||||
uint32_t u32;
|
||||
#ifdef CONFIG_HAVE_LONG_LONG
|
||||
uint64_t u64;
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef union epoll_data epoll_data_t;
|
||||
|
||||
Reference in New Issue
Block a user