add nonstandard GNU endian.h

This commit is contained in:
Lephenixnoir 2021-06-08 10:05:00 +02:00
parent 009a2eef6e
commit ed8134970b
Signed by: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
1 changed files with 21 additions and 0 deletions

View File

@ -0,0 +1,21 @@
#ifndef __ENDIAN_H__
# define __ENDIAN_H__
/* CASIO calculators are configured as big-endian. */
#define htobe16(x) (x)
#define htole16(x) (__builtin_bswap16(x))
#define be16toh(x) (x)
#define le16toh(x) (__builtin_bswap16(x))
#define htobe32(x) (x)
#define htole32(x) (__builtin_bswap32(x))
#define be32toh(x) (x)
#define le32toh(x) (__builtin_bswap32(x))
#define htobe64(x) (x)
#define htole64(x) (__builtin_bswap64(x))
#define be64toh(x) (x)
#define le64toh(x) (__builtin_bswap64(x))
#endif /*__ENDIAN_H__*/