192 |
|
* Data member wrappers |
193 |
|
*/ |
194 |
|
|
195 |
+ |
// Forward declarations |
196 |
+ |
struct datab; |
197 |
+ |
struct msgb; |
198 |
+ |
struct queue; |
199 |
+ |
struct multicast_node; |
200 |
+ |
struct DLPIStream; |
201 |
+ |
|
202 |
+ |
// Optimize for 32-bit big endian targets |
203 |
+ |
#if defined(WORDS_BIGENDIAN) && (SIZEOF_VOID_P == 4) |
204 |
+ |
|
205 |
+ |
// Predefined member types |
206 |
+ |
typedef int8 nw_int8; |
207 |
+ |
typedef int16 nw_int16; |
208 |
+ |
typedef int32 nw_int32; |
209 |
+ |
typedef uint8 nw_uint8; |
210 |
+ |
typedef uint16 nw_uint16; |
211 |
+ |
typedef uint32 nw_uint32; |
212 |
+ |
typedef bool nw_bool; |
213 |
+ |
typedef uint8 * nw_uint8_p; |
214 |
+ |
typedef void * nw_void_p; |
215 |
+ |
typedef datab * nw_datab_p; |
216 |
+ |
typedef msgb * nw_msgb_p; |
217 |
+ |
typedef queue * nw_queue_p; |
218 |
+ |
typedef multicast_node *nw_multicast_node_p; |
219 |
+ |
typedef DLPIStream * nw_DLPIStream_p; |
220 |
+ |
|
221 |
+ |
#else |
222 |
+ |
|
223 |
|
// Big-endian memory accessor |
224 |
|
template< int nbytes > |
225 |
|
struct nw_memory_helper; |
248 |
|
uint8 _pad[sizeof(type)]; |
249 |
|
public: |
250 |
|
operator public_type () const { |
251 |
< |
return (public_type)nw_memory_helper<sizeof(type)>::load((void *)this); |
251 |
> |
return (public_type)(uintptr)nw_memory_helper<sizeof(type)>::load((void *)this); |
252 |
|
} |
253 |
|
public_type operator -> () const { |
254 |
|
return this->operator public_type (); |
255 |
|
} |
256 |
|
nw_scalar_member_helper<type, public_type> & operator = (public_type val) { |
257 |
< |
nw_memory_helper<sizeof(type)>::store((void *)this, (type)val); |
257 |
> |
nw_memory_helper<sizeof(type)>::store((void *)this, (type)(uintptr)val); |
258 |
|
return *this; |
259 |
|
} |
260 |
|
nw_scalar_member_helper<type, public_type> & operator += (int val) { |
285 |
|
typedef nw_scalar_member_helper<int, bool> nw_bool; |
286 |
|
typedef nw_scalar_member_helper<uint32, uint8 *> nw_uint8_p; |
287 |
|
typedef nw_scalar_member_helper<uint32, void *> nw_void_p; |
260 |
– |
|
261 |
– |
struct datab; |
288 |
|
typedef nw_scalar_member_helper<uint32, datab *> nw_datab_p; |
263 |
– |
|
264 |
– |
struct msgb; |
289 |
|
typedef nw_scalar_member_helper<uint32, msgb *> nw_msgb_p; |
266 |
– |
|
267 |
– |
struct queue; |
290 |
|
typedef nw_scalar_member_helper<uint32, queue *> nw_queue_p; |
269 |
– |
|
270 |
– |
struct multicast_node; |
291 |
|
typedef nw_scalar_member_helper<uint32, multicast_node *> nw_multicast_node_p; |
272 |
– |
|
273 |
– |
struct DLPIStream; |
292 |
|
typedef nw_scalar_member_helper<uint32, DLPIStream *> nw_DLPIStream_p; |
293 |
|
|
294 |
+ |
#endif |
295 |
+ |
|
296 |
|
|
297 |
|
/* |
298 |
|
* Structures |