Skip to content

Commit

Permalink
fix macos build
Browse files Browse the repository at this point in the history
  • Loading branch information
radkesvat committed Aug 8, 2024
1 parent dec88b1 commit b6ad19c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion ww/utils/mathutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,24 +122,31 @@ static inline long minLong(long a, long b)
#define MAXOF(t) ((unsigned long long) (ISSIGNED(t) ? SMAXOF(t) : UMAXOF(t)))

#if __BIG_ENDIAN__

#ifndef htonll
#define htonll(x) (x)
#endif
#ifndef ntohll
#define ntohll(x) (x)
#endif

#else

#ifndef htonll
static inline uint64_t htonll(uint64_t x)
{
uint32_t low = htonl((uint32_t) (x & 0xFFFFFFFF));
uint32_t high = htonl((uint32_t) (x >> 32));
return ((uint64_t) low << 32) | high;
}

#endif
#ifndef ntohll
static inline uint64_t ntohll(uint64_t x)
{
uint32_t low = ntohl((uint32_t) (x & 0xFFFFFFFF));
uint32_t high = ntohl((uint32_t) (x >> 32));
return ((uint64_t) low << 32) | high;
}
#endif

#endif

0 comments on commit b6ad19c

Please sign in to comment.