Skip to content

Commit

Permalink
FIX: compilation failure when using XCode
Browse files Browse the repository at this point in the history
  • Loading branch information
Oldes committed Jul 26, 2024
1 parent 0692803 commit 37544ea
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions src/include/reb-c.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,11 @@ typedef void(*CFUNC)(void *);
**
***********************************************************************/

#ifdef __has_builtin
# define HAS_BUILTIN(x) __has_builtin(x)
#else
# define HAS_BUILTIN(x) 0
#endif

#if defined(_MSC_VER)
# define FORCE_INLINE __forceinline
Expand All @@ -259,16 +264,21 @@ typedef void(*CFUNC)(void *);
// Other compilers..
#else // defined(_MSC_VER)
# define FORCE_INLINE inline __attribute__((always_inline))
inline uint32_t rotl32(uint32_t x, int8_t r)
{
return (x << r) | (x >> (32 - r));
}
inline uint64_t rotl64(uint64_t x, int8_t r)
{
return (x << r) | (x >> (64 - r));
}
# define ROTL32(x,y) rotl32(x,y)
# define ROTL64(x,y) rotl64(x,y)
# if HAS_BUILTIN(__builtin_rotateleft32) && HAS_BUILTIN(__builtin_rotateleft64)
# define ROTL32(x,y) __builtin_rotateleft32(x,y)
# define ROTL64(x,y) __builtin_rotateleft64(x,y)
# else
FORCE_INLINE uint32_t rotl32(uint32_t x, int8_t r)
{
return (x << r) | (x >> (32 - r));
}
FORCE_INLINE uint64_t rotl64(uint64_t x, int8_t r)
{
return (x << r) | (x >> (64 - r));
}
# define ROTL32(x,y) rotl32(x,y)
# define ROTL64(x,y) rotl64(x,y)
# endif
# define BIG_CONSTANT(x) (x##LLU)
#endif // !defined(_MSC_VER)

Expand Down

0 comments on commit 37544ea

Please sign in to comment.