Make it work on opensolaris
[fio.git] / crc / sha256.c
index 8ec2943294e48ac2a3e9e22892a0723fa05b4f8e..fe08ab3a0e0554ed417e6b7c11dedadffd20677b 100644 (file)
  */
 #include <string.h>
 #include <inttypes.h>
-#include <byteswap.h>
-#include <endian.h>
 
 #include "sha256.h"
 
 #if __BYTE_ORDER == __LITTLE_ENDIAN
-#define        __be32_to_cpu(x)        __bswap_32(x)
+static int __be32_to_cpu(uint32_t val)
+{
+       uint32_t c1, c2, c3, c4;
+
+       c1 = (val >> 24) & 0xff;
+       c2 = (val >> 16) & 0xff;
+       c3 = (val >> 8) & 0xff;
+       c4 = val & 0xff;
+
+       return c1 | c2 << 8 | c3 << 16 | c4 << 24;
+}
 #else
 #define __be32_to_cpu(x)       (x)
 #endif