Fix some incorrect endianness checks.

MFC after:	1 week
Sponsored by:	EMC / Isilon Storage Division
This commit is contained in:
Mark Johnston 2014-09-17 00:54:00 +00:00
parent a5ddd965e0
commit 6574b8ed19
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=271695
2 changed files with 3 additions and 3 deletions

View File

@ -274,7 +274,7 @@ ctf_fdopen(int fd, int *errp)
*/ */
if (nbytes >= (ssize_t) sizeof (Elf32_Ehdr) && if (nbytes >= (ssize_t) sizeof (Elf32_Ehdr) &&
bcmp(&hdr.e32.e_ident[EI_MAG0], ELFMAG, SELFMAG) == 0) { bcmp(&hdr.e32.e_ident[EI_MAG0], ELFMAG, SELFMAG) == 0) {
#ifdef _BIG_ENDIAN #if BYTE_ORDER == _BIG_ENDIAN
uchar_t order = ELFDATA2MSB; uchar_t order = ELFDATA2MSB;
#else #else
uchar_t order = ELFDATA2LSB; uchar_t order = ELFDATA2LSB;

View File

@ -167,7 +167,7 @@ print_bitfield(dt_printarg_t *pap, ulong_t off, ctf_encoding_t *ep)
* to the lowest 'size' bytes in 'value', and we need to shift based on * to the lowest 'size' bytes in 'value', and we need to shift based on
* the offset from the end of the data, not the offset of the start. * the offset from the end of the data, not the offset of the start.
*/ */
#ifdef _BIG_ENDIAN #if BYTE_ORDER == _BIG_ENDIAN
buf += sizeof (value) - size; buf += sizeof (value) - size;
off += ep->cte_bits; off += ep->cte_bits;
#endif #endif
@ -178,7 +178,7 @@ print_bitfield(dt_printarg_t *pap, ulong_t off, ctf_encoding_t *ep)
* Offsets are counted from opposite ends on little- and * Offsets are counted from opposite ends on little- and
* big-endian machines. * big-endian machines.
*/ */
#ifdef _BIG_ENDIAN #if BYTE_ORDER == _BIG_ENDIAN
shift = NBBY - shift; shift = NBBY - shift;
#endif #endif