Lines 1-41
Link Here
|
1 |
--- icotool/win32-endian.c.orig Sun Nov 27 18:43:33 2005 |
|
|
2 |
+++ icotool/win32-endian.c Sun Nov 27 21:05:48 2005 |
3 |
@@ -17,6 +17,10 @@ |
4 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
5 |
*/ |
6 |
|
7 |
+#if (defined(__unix__) || defined(unix)) && !defined(USG) |
8 |
+#include <sys/param.h> |
9 |
+#endif |
10 |
+ |
11 |
#include <config.h> |
12 |
#include "win32-endian.h" |
13 |
|
14 |
@@ -27,6 +31,27 @@ |
15 |
#define bswap_16(x) NXSwapShort(x) |
16 |
#define bswap_32(x) NXSwapInt(x) |
17 |
#define bswap_64(x) NXSwapLongLong(x) |
18 |
+#elif defined(__FreeBSD__) && (__FreeBSD_version >= 470000) |
19 |
+# include <sys/endian.h> |
20 |
+# if (__FreeBSD_version >= 500000) |
21 |
+# define bswap_16(x) bswap16(x) |
22 |
+# define bswap_32(x) bswap32(x) |
23 |
+# define bswap_64(x) bswap64(x) |
24 |
+# else |
25 |
+# define bswap_16(x) be16toh(x) |
26 |
+# define bswap_32(x) be32toh(x) |
27 |
+# define bswap_64(x) \ |
28 |
+ x = ((((x) & 0xff00000000000000) >> 56) | \ |
29 |
+ (((x) & 0x00ff000000000000) >> 40) | \ |
30 |
+ (((x) & 0x0000ff0000000000) >> 24) | \ |
31 |
+ (((x) & 0x000000ff00000000) >> 8) | \ |
32 |
+ (((x) & 0x00000000ff000000) << 8) | \ |
33 |
+ (((x) & 0x0000000000ff0000) << 24) | \ |
34 |
+ (((x) & 0x000000000000ff00) << 40) | \ |
35 |
+ (((x) & 0x00000000000000ff) << 56)) |
36 |
+# endif /* >= 4.7-R || >= 5.0-CURRENT */ |
37 |
+#else |
38 |
+# include "common/byteswap.h" |
39 |
#endif |
40 |
|
41 |
#define BSWAP16(x) ((x) = bswap_16(x)) |