summaryrefslogtreecommitdiff
path: root/sysutils/xentools30/patches/patch-by
blob: 8f4ecf9145ceb70ad3d0ee928adc669143d6de33 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
$NetBSD: patch-by,v 1.1.1.1 2006/07/02 16:49:31 bouyer Exp $

--- misc/mbootpack/mbootpack.h.orig	2006-01-31 17:09:21.000000000 +0100
+++ misc/mbootpack/mbootpack.h
@@ -32,7 +32,25 @@
 #undef NDEBUG
 #include <stdio.h>
 
-#include <endian.h>
+#ifdef __NetBSD__
+#include <sys/endian.h>
+#if _BYTE_ORDER == _LITTLE_ENDIAN
+#define eswap(x) (x)
+#else 
+#define eswap(x)                                               \
+        ({                                                      \
+               typeof(x) y = (x);                              \
+               switch(sizeof(y))                               \
+               {                                               \
+               case 2: y = bswap_16(y); break;                 \
+               case 4: y = bswap_32(y); break;                 \
+               case 8: y = bswap_64(y); break;                 \
+               }                                               \
+               y;                                              \
+        })	
+#endif			
+#else /* __NetBSD__ */
+#include </endian.h>
 #include <byteswap.h>
 #if __BYTE_ORDER == __LITTLE_ENDIAN
 #define eswap(x) (x)
@@ -49,6 +67,7 @@
                y;                                              \
         })	
 #endif			
+#endif /* !__NetBSD */
 
 /* Flags */
 extern int quiet;