diff options
author | Jeff Garzik <jgarzik@exmulti.com> | 2011-05-10 11:49:04 -0700 |
---|---|---|
committer | Jeff Garzik <jgarzik@exmulti.com> | 2011-05-10 11:49:04 -0700 |
commit | 289a599258ba9e828e856e8298eaf3ac48fe9026 (patch) | |
tree | a653c5a27d32dad965d5db015504671465b6cefd | |
parent | 16cddaf3004c2f73a8880dce36c3a4c714bc82ef (diff) | |
parent | 180b99f2d922a4575773c2c90eb7d37092e17f7c (diff) |
Merge pull request #17 from metonymous/master
OSX CPU Support
-rw-r--r-- | miner.h | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -52,8 +52,29 @@ void *alloca (size_t); #if ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) #define WANT_BUILTIN_BSWAP #else +#if HAVE_BYTESWAP_H #include <byteswap.h> +#elif defined(USE_SYS_ENDIAN_H) +#include <sys/endian.h> +#elif defined(__APPLE__) +#include <libkern/OSByteOrder.h> +#define bswap_16 OSSwapInt16 +#define bswap_32 OSSwapInt32 +#define bswap_64 OSSwapInt64 +#else +#define bswap_16(value) \ + ((((value) & 0xff) << 8) | ((value) >> 8)) + +#define bswap_32(value) \ + (((uint32_t)bswap_16((uint16_t)((value) & 0xffff)) << 16) | \ + (uint32_t)bswap_16((uint16_t)((value) >> 16))) + +#define bswap_64(value) \ + (((uint64_t)bswap_32((uint32_t)((value) & 0xffffffff)) \ + << 32) | \ + (uint64_t)bswap_32((uint32_t)((value) >> 32))) #endif +#endif /* !defined(__GLXBYTEORDER_H__) */ #ifdef HAVE_SYSLOG_H #include <syslog.h> |