Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AIX lacks be16toh, htobe64 and alike #1117

Open
AIIleG opened this issue Oct 22, 2024 · 0 comments
Open

AIX lacks be16toh, htobe64 and alike #1117

AIIleG opened this issue Oct 22, 2024 · 0 comments

Comments

@AIIleG
Copy link

AIIleG commented Oct 22, 2024

Adding the following to include/compat/endian.h worked for me:

#if defined _AIX /* AIX is always big endian */
#define be64toh(x) (x)
#define be32toh(x) (x)
#define be16toh(x) (x)
#define le32toh(x)             \
	((((x) & 0xff) << 24) |    \
	(((x) & 0xff00) << 8) |    \
	(((x) & 0xff0000) >> 8) |  \
	(((x) & 0xff000000) >> 24))
#define le64toh(x)                          \
	((((x) & 0x00000000000000ffL) << 56) |  \
	(((x) & 0x000000000000ff00L) << 40) |   \
	(((x) & 0x0000000000ff0000L) << 24) |   \
	(((x) & 0x00000000ff000000L) << 8)  |   \
	(((x) & 0x000000ff00000000L) >> 8)  |   \
	(((x) & 0x0000ff0000000000L) >> 24) |   \
	(((x) & 0x00ff000000000000L) >> 40) |   \
	(((x) & 0xff00000000000000L) >> 56))
#ifndef htobe64
#define htobe64(x) be64toh(x)
#endif
#ifndef htobe32
#define htobe32(x) be32toh(x)
#endif
#ifndef htobe16
#define htobe16(x) be16toh(x)
#endif
#ifndef htole32
#define htole32(x) le32toh(x)
#endif
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant