comparison src/define.h @ 128:7f747c8c9d02

cleanup installed headers
author Carl Byington <carl@five-ten-sg.com>
date Thu, 05 Feb 2009 09:22:22 -0800
parents ab2a11e72250
children fc11b1d1ad34
comparison
equal deleted inserted replaced
127:c2482d0cd84e 128:7f747c8c9d02
5 * dave.s@earthcorp.com 5 * dave.s@earthcorp.com
6 */ 6 */
7 7
8 #ifndef DEFINEH_H 8 #ifndef DEFINEH_H
9 #define DEFINEH_H 9 #define DEFINEH_H
10
11 #include "common.h"
10 12
11 #ifdef HAVE_CONFIG_H 13 #ifdef HAVE_CONFIG_H
12 #include "config.h" 14 #include "config.h"
13 #endif 15 #endif
14 16
296 unsigned int end; 298 unsigned int end;
297 unsigned int line; 299 unsigned int line;
298 unsigned int type; 300 unsigned int type;
299 }; 301 };
300 302
303 #if BYTE_ORDER == BIG_ENDIAN
304 # define LE64_CPU(x) \
305 x = ((((x) & UINT64_C(0xff00000000000000)) >> 56) | \
306 (((x) & UINT64_C(0x00ff000000000000)) >> 40) | \
307 (((x) & UINT64_C(0x0000ff0000000000)) >> 24) | \
308 (((x) & UINT64_C(0x000000ff00000000)) >> 8 ) | \
309 (((x) & UINT64_C(0x00000000ff000000)) << 8 ) | \
310 (((x) & UINT64_C(0x0000000000ff0000)) << 24) | \
311 (((x) & UINT64_C(0x000000000000ff00)) << 40) | \
312 (((x) & UINT64_C(0x00000000000000ff)) << 56));
313 # define LE32_CPU(x) \
314 x = ((((x) & 0xff000000) >> 24) | \
315 (((x) & 0x00ff0000) >> 8 ) | \
316 (((x) & 0x0000ff00) << 8 ) | \
317 (((x) & 0x000000ff) << 24));
318 # define LE16_CPU(x) \
319 x = ((((x) & 0xff00) >> 8) | \
320 (((x) & 0x00ff) << 8));
321 #elif BYTE_ORDER == LITTLE_ENDIAN
322 # define LE64_CPU(x) {}
323 # define LE32_CPU(x) {}
324 # define LE16_CPU(x) {}
325 #else
326 # error "Byte order not supported by this library"
327 #endif // BYTE_ORDER
328
329
330 #define PST_LE_GET_UINT64(p) \
331 (uint64_t)((((uint8_t const *)(p))[0] << 0) | \
332 (((uint8_t const *)(p))[1] << 8) | \
333 (((uint8_t const *)(p))[2] << 16) | \
334 (((uint8_t const *)(p))[3] << 24) | \
335 (((uint8_t const *)(p))[4] << 32) | \
336 (((uint8_t const *)(p))[5] << 40) | \
337 (((uint8_t const *)(p))[6] << 48) | \
338 (((uint8_t const *)(p))[7] << 56))
339
340 #define PST_LE_GET_INT64(p) \
341 (int64_t)((((uint8_t const *)(p))[0] << 0) | \
342 (((uint8_t const *)(p))[1] << 8) | \
343 (((uint8_t const *)(p))[2] << 16) | \
344 (((uint8_t const *)(p))[3] << 24) | \
345 (((uint8_t const *)(p))[4] << 32) | \
346 (((uint8_t const *)(p))[5] << 40) | \
347 (((uint8_t const *)(p))[6] << 48) | \
348 (((uint8_t const *)(p))[7] << 56))
349
350 #define PST_LE_GET_UINT32(p) \
351 (uint32_t)((((uint8_t const *)(p))[0] << 0) | \
352 (((uint8_t const *)(p))[1] << 8) | \
353 (((uint8_t const *)(p))[2] << 16) | \
354 (((uint8_t const *)(p))[3] << 24))
355
356 #define PST_LE_GET_INT32(p) \
357 (int32_t)((((uint8_t const *)(p))[0] << 0) | \
358 (((uint8_t const *)(p))[1] << 8) | \
359 (((uint8_t const *)(p))[2] << 16) | \
360 (((uint8_t const *)(p))[3] << 24))
361
362 #define PST_LE_GET_UINT16(p) \
363 (uint16_t)((((uint8_t const *)(p))[0] << 0) | \
364 (((uint8_t const *)(p))[1] << 8))
365
366 #define PST_LE_GET_INT16(p) \
367 (int16_t)((((uint8_t const *)(p))[0] << 0) | \
368 (((uint8_t const *)(p))[1] << 8))
369
370 #define PST_LE_GET_UINT8(p) (*(uint8_t const *)(p))
371
372 #define PST_LE_GET_INT8(p) (*(int8_t const *)(p))
373
301 #endif //DEFINEH_H 374 #endif //DEFINEH_H