static __inline__ uint32_t byteswap32_to_host(uint32_t value)
{
- if (byteswap == 1) {
+ if (byteswap) {
return (bswap_32(value));
} else {
return (value);
}
static __inline__ uint64_t byteswap64_to_host(uint64_t value)
{
- if (byteswap == 1) {
+ if (byteswap) {
return (bswap_64(value));
} else {
return (value);
}
/* Check if the target endianness matches the host's endianness */
- byteswap = 0;
- if (UCLIBC_ENDIAN_HOST == UCLIBC_ENDIAN_LITTLE) {
- if (ehdr->e_ident[5] == ELFDATA2MSB)
- byteswap = 1;
- } else if (UCLIBC_ENDIAN_HOST == UCLIBC_ENDIAN_BIG) {
- if (ehdr->e_ident[5] == ELFDATA2LSB)
- byteswap = 1;
- }
+ byteswap = (ehdr->e_ident[5] == ELFDATAM) ? 0 : 1;
/* Be very lazy, and only byteswap the stuff we use */
if (byteswap) {