• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1--- /home/chris/oh_patchlibc_0803/openharmony/third_party/musl/include/endian.h	2023-08-07 15:19:23.160403358 +0800
2+++ topatch/include/endian.h	2023-08-07 16:24:49.177114612 +0800
3@@ -1,3 +1,14 @@
4+/*
5+ * Copyright (c) 2023 Institute of Parallel And Distributed Systems (IPADS), Shanghai Jiao Tong University (SJTU)
6+ * Licensed under the Mulan PSL v2.
7+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
8+ * You may obtain a copy of Mulan PSL v2 at:
9+ *     http://license.coscl.org.cn/MulanPSL2
10+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
11+ * IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
12+ * PURPOSE.
13+ * See the Mulan PSL v2 for more details.
14+ */
15 #ifndef _ENDIAN_H
16 #define _ENDIAN_H
17
18@@ -11,24 +22,24 @@
19
20 #define __PDP_ENDIAN 3412
21
22-#define BIG_ENDIAN __BIG_ENDIAN
23+#define BIG_ENDIAN    __BIG_ENDIAN
24 #define LITTLE_ENDIAN __LITTLE_ENDIAN
25-#define PDP_ENDIAN __PDP_ENDIAN
26-#define BYTE_ORDER __BYTE_ORDER
27+#define PDP_ENDIAN    __PDP_ENDIAN
28+#define BYTE_ORDER    __BYTE_ORDER
29
30 static __inline uint16_t __bswap16(uint16_t __x)
31 {
32-	return __x<<8 | __x>>8;
33+    return __x << 8 | __x >> 8;
34 }
35
36 static __inline uint32_t __bswap32(uint32_t __x)
37 {
38-	return __x>>24 | __x>>8&0xff00 | __x<<8&0xff0000 | __x<<24;
39+    return __x >> 24 | __x >> (8 & 0xff00) | __x << (8 & 0xff0000) | __x << 24;
40 }
41
42 static __inline uint64_t __bswap64(uint64_t __x)
43 {
44-	return __bswap32(__x)+0ULL<<32 | __bswap32(__x>>32);
45+    return (__bswap32(__x) + 0ULL) << 32 | __bswap32(__x >> 32);
46 }
47
48 #if __BYTE_ORDER == __LITTLE_ENDIAN
49