[KSECDD]
[reactos.git] / reactos / lib / cryptlib / util.c
1
2
3 #if !defined(_MSC_VER) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
4 #include <stdlib.h>
5 #include <intrin.h>
6
7 void
8 byteReverse(unsigned char *buf, unsigned longs)
9 {
10 unsigned int t;
11
12 do
13 {
14 #if 0
15 t = (unsigned int)((unsigned)buf[3] << 8 | buf[2]) << 16 |
16 ((unsigned)buf[1] << 8 | buf[0]);
17 #else
18 t = _byteswap_ulong(*(unsigned int *)buf);
19 #endif
20 *(unsigned int *)buf = t;
21 buf += 4;
22 } while (--longs);
23 }
24
25 #endif // !defined(_MSC_VER) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
26