Debian Codegraph @

mednafen/mednafen-endian.h

raw symbols SCIP
1 #cxx . . $ `<file>/mednafen/mednafen-endian.h`/ifndef __MDFN_ENDIAN_H
2 #define __MDFN_ENDIAN_Hcxx . . $ `mednafen/mednafen-endian.h:2:9`!
3
4 #include <stdio.h>
5 #include <stdint.h>
6
7 #ifdef MSB_FIRST
8 #ifndef le32toh
9 #define le32toh(l) ((((l)>>24) & 0xff) | (((l)>>8) & 0xff00) \
10 | (((l)<<8) & 0xff0000) | (((l)<<24) & 0xff000000))
11 #endif
12 #ifndef le16toh
13 #define le16toh(l) ((((l)>>8) & 0xff) | (((l)<<8) & 0xff00))
14 #endif
15 #else
16 #ifndef le32tohcxx . . $ `<external>/15855202785537844739/endian.h:47:11`!
17 #define le32tohcxx . . $ `mednafen/mednafen-endian.h:17:9`!(l) (l)
18 #endif
19 #ifndef le16tohcxx . . $ `<external>/15855202785537844739/endian.h:42:11`!
20 #define le16tohcxx . . $ `mednafen/mednafen-endian.h:20:9`!(l) (l)
21 #endif
22 #endif
23
24 #ifndef htole32cxx . . $ `<external>/15855202785537844739/endian.h:45:11`!
25 #define htole32cxx . . $ `mednafen/mednafen-endian.h:25:9`! le32toh
26 #endif
27
28 #ifndef htole16cxx . . $ `<external>/15855202785537844739/endian.h:40:11`!
29 #define htole16cxx . . $ `mednafen/mednafen-endian.h:29:9`! le16toh
30 #endif
31
32 #ifdef __cpluspluscxx . . $ `<built-in>:470:9`!
33 extern "C" {
34 #endif
35
36 int write16lecxx . . $ write16le(92a94ed720415298).(uint16_tcxx . . $ uint16_t# b, FILEcxx . . $ FILE# *fp);
37 int write32lecxx . . $ write32le(667defc730483286).(uint32_tcxx . . $ uint32_t# b, FILEcxx . . $ FILE# *fp);
38 int read32lecxx . . $ read32le(f3c8ec9dc30317c7).(uint32_tcxx . . $ uint32_t# *Bufo, FILEcxx . . $ FILE# *fp);
39
40 void Endian_A16_Swapcxx . . $ Endian_A16_Swap(67abb4dd43ac34c5).(void *src, uint32_tcxx . . $ uint32_t# nelements);
41 void Endian_A32_Swapcxx . . $ Endian_A32_Swap(67abb4dd43ac34c5).(void *src, uint32_tcxx . . $ uint32_t# nelements);
42 void Endian_A64_Swapcxx . . $ Endian_A64_Swap(67abb4dd43ac34c5).(void *src, uint32_tcxx . . $ uint32_t# nelements);
43
44 void Endian_A16_LE_to_NEcxx . . $ Endian_A16_LE_to_NE(67abb4dd43ac34c5).(void *src, uint32_tcxx . . $ uint32_t# nelements);
45 void Endian_A16_BE_to_NEcxx . . $ Endian_A16_BE_to_NE(67abb4dd43ac34c5).(void *src, uint32_tcxx . . $ uint32_t# nelements);
46 void Endian_A32_LE_to_NEcxx . . $ Endian_A32_LE_to_NE(67abb4dd43ac34c5).(void *src, uint32_tcxx . . $ uint32_t# nelements);
47 void Endian_A64_LE_to_NEcxx . . $ Endian_A64_LE_to_NE(67abb4dd43ac34c5).(void *src, uint32_tcxx . . $ uint32_t# nelements);
48
49 void FlipByteOrdercxx . . $ FlipByteOrder(e1e8b00c42c42532).(uint8_tcxx . . $ uint8_t# *src, uint32_tcxx . . $ uint32_t# count);
50
51 // The following functions can encode/decode to unaligned addresses.
52
53 static inline void MDFN_en16lsbcxx . . $ MDFN_en16lsb(5f425e2ac950790c).(uint8_tcxx . . $ uint8_t# *buf, uint16_tcxx . . $ uint16_t# morp)
54 {
55 buf[0]=morp;
56 buf[1]=morp>>8;
57 }
58
59 static inline void MDFN_en24lsbcxx . . $ MDFN_en24lsb(e1e8b00c42c42532).(uint8_tcxx . . $ uint8_t# *buf, uint32_tcxx . . $ uint32_t# morp)
60 {
61 buf[0]=morp;
62 buf[1]=morp>>8;
63 buf[2]=morp>>16;
64 }
65
66
67 static inline void MDFN_en32lsbcxx . . $ MDFN_en32lsb(e1e8b00c42c42532).(uint8_tcxx . . $ uint8_t# *buf, uint32_tcxx . . $ uint32_t# morp)
68 {
69 buf[0]=morp;
70 buf[1]=morp>>8;
71 buf[2]=morp>>16;
72 buf[3]=morp>>24;
73 }
74
75 static inline void MDFN_en64lsbcxx . . $ MDFN_en64lsb(6165b45f45ef689c).(uint8_tcxx . . $ uint8_t# *buf, uint64_tcxx . . $ uint64_t# morp)
76 {
77 buf[0]=morp >> 0;
78 buf[1]=morp >> 8;
79 buf[2]=morp >> 16;
80 buf[3]=morp >> 24;
81 buf[4]=morp >> 32;
82 buf[5]=morp >> 40;
83 buf[6]=morp >> 48;
84 buf[7]=morp >> 56;
85 }
86
87
88 static inline void MDFN_en16msbcxx . . $ MDFN_en16msb(5f425e2ac950790c).(uint8_tcxx . . $ uint8_t# *buf, uint16_tcxx . . $ uint16_t# morp)
89 {
90 buf[0] = morp >> 8;
91 buf[1] = morp;
92 }
93
94 static inline void MDFN_en24msbcxx . . $ MDFN_en24msb(e1e8b00c42c42532).(uint8_tcxx . . $ uint8_t# *buf, uint32_tcxx . . $ uint32_t# morp)
95 {
96 buf[0] = morp >> 16;
97 buf[1] = morp >> 8;
98 buf[2] = morp;
99 }
100
101 static inline void MDFN_en32msbcxx . . $ MDFN_en32msb(e1e8b00c42c42532).(uint8_tcxx . . $ uint8_t# *buf, uint32_tcxx . . $ uint32_t# morp)
102 {
103 buf[0] = morp >> 24;
104 buf[1] = morp >> 16;
105 buf[2] = morp >> 8;
106 buf[3] = morp;
107 }
108
109 static inline void MDFN_en64msbcxx . . $ MDFN_en64msb(6165b45f45ef689c).(uint8_tcxx . . $ uint8_t# *buf, uint64_tcxx . . $ uint64_t# morp)
110 {
111 buf[0] = morp >> 56;
112 buf[1] = morp >> 48;
113 buf[2] = morp >> 40;
114 buf[3] = morp >> 32;
115 buf[4] = morp >> 24;
116 buf[5] = morp >> 16;
117 buf[6] = morp >> 8;
118 buf[7] = morp >> 0;
119 }
120
121 static inline uint16_tcxx . . $ uint16_t# MDFN_de16lsbcxx . . $ MDFN_de16lsb(469dcb4e54b221a8).(const uint8_tcxx . . $ uint8_t# *morp)
122 {
123 return(morp[0] | (morp[1] << 8));
124 }
125
126 static inline uint32_tcxx . . $ uint32_t# MDFN_de24lsbcxx . . $ MDFN_de24lsb(ca1608e2c87725e2).(const uint8_tcxx . . $ uint8_t# *morp)
127 {
128 return(morp[0]|(morp[1]<<8)|(morp[2]<<16));
129 }
130
131 static inline uint32_tcxx . . $ uint32_t# MDFN_de32lsbcxx . . $ MDFN_de32lsb(ca1608e2c87725e2).(const uint8_tcxx . . $ uint8_t# *morp)
132 {
133 return(morp[0]|(morp[1]<<8)|(morp[2]<<16)|(morp[3]<<24));
134 }
135
136 static inline uint64_tcxx . . $ uint64_t# MDFN_de64lsbcxx . . $ MDFN_de64lsb(b191ace3c5bffbd9).(const uint8_tcxx . . $ uint8_t# *morp)
137 {
138 uint64_tcxx . . $ uint64_t# ret = 0;
139
140 ret |= (uint64_tcxx . . $ uint64_t#)morp[0];
141 ret |= (uint64_tcxx . . $ uint64_t#)morp[1] << 8;
142 ret |= (uint64_tcxx . . $ uint64_t#)morp[2] << 16;
143 ret |= (uint64_tcxx . . $ uint64_t#)morp[3] << 24;
144 ret |= (uint64_tcxx . . $ uint64_t#)morp[4] << 32;
145 ret |= (uint64_tcxx . . $ uint64_t#)morp[5] << 40;
146 ret |= (uint64_tcxx . . $ uint64_t#)morp[6] << 48;
147 ret |= (uint64_tcxx . . $ uint64_t#)morp[7] << 56;
148
149 return(ret);
150 }
151
152 static inline uint16_tcxx . . $ uint16_t# MDFN_de16msbcxx . . $ MDFN_de16msb(469dcb4e54b221a8).(const uint8_tcxx . . $ uint8_t# *morp)
153 {
154 return(morp[1] | (morp[0] << 8));
155 }
156
157 static inline uint32_tcxx . . $ uint32_t# MDFN_de24msbcxx . . $ MDFN_de24msb(ca1608e2c87725e2).(const uint8_tcxx . . $ uint8_t# *morp)
158 {
159 return((morp[2]<<0)|(morp[1]<<8)|(morp[0]<<16));
160 }
161
162
163 static inline uint32_tcxx . . $ uint32_t# MDFN_de32msbcxx . . $ MDFN_de32msb(ca1608e2c87725e2).(const uint8_tcxx . . $ uint8_t# *morp)
164 {
165 return(morp[3]|(morp[2]<<8)|(morp[1]<<16)|(morp[0]<<24));
166 }
167
168 #ifdef __cpluspluscxx . . $ `<built-in>:470:9`!
169 }
170 #endif
171
172 #endif