瀏覽代碼

Added the "swap in place" macros

tags/v0.9.3
Michael Brown 18 年之前
父節點
當前提交
bb8725bffa
共有 2 個文件被更改,包括 24 次插入0 次删除
  1. 12
    0
      src/include/big_bswap.h
  2. 12
    0
      src/include/little_bswap.h

+ 12
- 0
src/include/big_bswap.h 查看文件

@@ -17,5 +17,17 @@
17 17
 #define be64_to_cpu(x)	(x)
18 18
 #define be32_to_cpu(x)	(x)
19 19
 #define be16_to_cpu(x)	(x)
20
+#define cpu_to_le64s(x) __bswap_64s(x)
21
+#define cpu_to_le32s(x) __bswap_32s(x)
22
+#define cpu_to_le16s(x) __bswap_16s(x)
23
+#define cpu_to_be64s(x) do {} while (0)
24
+#define cpu_to_be32s(x) do {} while (0)
25
+#define cpu_to_be16s(x) do {} while (0)
26
+#define le64_to_cpus(x) __bswap_64s(x)
27
+#define le32_to_cpus(x) __bswap_32s(x)
28
+#define le16_to_cpus(x) __bswap_16s(x)
29
+#define be64_to_cpus(x) do {} while (0)
30
+#define be32_to_cpus(x) do {} while (0)
31
+#define be16_to_cpus(x) do {} while (0)
20 32
 
21 33
 #endif /* ETHERBOOT_BIG_BSWAP_H */

+ 12
- 0
src/include/little_bswap.h 查看文件

@@ -17,5 +17,17 @@
17 17
 #define be64_to_cpu(x)	__bswap_64(x)
18 18
 #define be32_to_cpu(x)	__bswap_32(x)
19 19
 #define be16_to_cpu(x)	__bswap_16(x)
20
+#define cpu_to_le64s(x) do {} while (0)
21
+#define cpu_to_le32s(x) do {} while (0)
22
+#define cpu_to_le16s(x) do {} while (0)
23
+#define cpu_to_be64s(x) __bswap_64s(x)
24
+#define cpu_to_be32s(x) __bswap_32s(x)
25
+#define cpu_to_be16s(x) __bswap_16s(x)
26
+#define le64_to_cpus(x) do {} while (0)
27
+#define le32_to_cpus(x) do {} while (0)
28
+#define le16_to_cpus(x) do {} while (0)
29
+#define be64_to_cpus(x) __bswap_64s(x)
30
+#define be32_to_cpus(x) __bswap_32s(x)
31
+#define be16_to_cpus(x) __bswap_16s(x)
20 32
 
21 33
 #endif /* ETHERBOOT_LITTLE_BSWAP_H */

Loading…
取消
儲存