summaryrefslogtreecommitdiff
path: root/user/efivar/0001-makeguids-Ensure-compatibility-with-other-libcs.patch
blob: a49e3ae6e92126c94cb61b74b48c7dad1b860e17 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
diff -ur a/src/makeguids.c b/src/makeguids.c
--- a/src/makeguids.c	2022-04-28 20:29:22.239917877 +0000
+++ b/src/makeguids.c	2022-04-28 20:32:15.714633086 +0000
@@ -178,6 +178,15 @@
 	fprintf(symout, "#include <efivar/efivar.h>\n");
 	fprintf(symout, "#include <endian.h>\n");
 	fprintf(symout, "\n\
+#ifndef __bswap_constant_16\n\
+#define __bswap_constant_16(x)\\\n\
+	((unsigned short int) ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8)))\n\
+#endif\n\
+#ifndef __bswap_constant_32\n\
+#define __bswap_constant_32(x)\\\n\
+	((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >>  8) | \\\n\
+	 (((x) & 0x0000ff00) <<  8) | (((x) & 0x000000ff) << 24))\n\
+#endif\n\
 #if BYTE_ORDER == BIG_ENDIAN\n\
 #define cpu_to_be32(n) (n)\n\
 #define cpu_to_be16(n) (n)\n\