Skip to content

Commit

Permalink
Fix compile / load for compilers without builtin
Browse files Browse the repository at this point in the history
Signed-off-by: Kimball Thurston <[email protected]>
  • Loading branch information
kdt3rd committed Dec 31, 2024
1 parent ea1d908 commit 0bfd088
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/lib/OpenEXRCore/internal_huf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1056,15 +1056,20 @@ readUInt (const uint8_t* b)
/* unaligned reads are UB, so can't just cast the way c++ used to
* (chars are special and we don't want to use those anyway) so just
* do the simple thing... */
#if 1
#if defined(__has_builtin)
# if __has_builtin(__builtin_bswap64)
# define HAVE_READ64
static inline uint64_t
READ64(const uint8_t * c)
{
uint64_t x;
memcpy(&x, c, sizeof(uint64_t));
return __builtin_bswap64 (x);
}
#else
# endif
#endif

#ifndef HAVE_READ64
//#define READ64(c) __builtin_bswap64 (*(const uint64_t*) (c))
# define READ64(c) \
((uint64_t) (c)[0] << 56) | ((uint64_t) (c)[1] << 48) | \
Expand Down

0 comments on commit 0bfd088

Please sign in to comment.