From a68bdea45ce05f950cacc433d6943a625f089538 Mon Sep 17 00:00:00 2001 From: Laurent Vivier Date: Tue, 14 Dec 2004 16:23:09 +0000 Subject: [PATCH] moved to ../libemile/ --- tools/emile.h | 67 --------------------------------------------------- 1 file changed, 67 deletions(-) delete mode 100644 tools/emile.h diff --git a/tools/emile.h b/tools/emile.h deleted file mode 100644 index 7004edc..0000000 --- a/tools/emile.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * - * (c) 2004 Laurent Vivier - * - */ - -#include - -#if __BYTE_ORDER == __BIG_ENDIAN - -/* nothing to do, because m68k is big endian too */ - -static inline u_int16_t read_short(u_int16_t* addr) -{ - return *addr; -} - -static inline void write_short(u_int16_t* addr, u_int16_t value) -{ - *addr = value; -} - -static inline u_int32_t read_long(u_int32_t* addr) -{ - return *addr; -} - -static inline void write_long(u_int32_t* addr, u_int32_t value) -{ - *addr = value; -} - -#else /* __BYTE_ORDER == __LITTLE_ENDIAN */ - -/* little endian (or unknown), read byte by byte to get it in good order */ - -static inline u_int16_t read_short(u_int16_t* addr) -{ - unsigned char* baddr = (unsigned char*)addr; - - return ((u_int16_t)(*baddr) << 8) | (u_int16_t)*(baddr+1); -} - -static inline void write_short(u_int16_t* addr, u_int16_t value) -{ - unsigned char* baddr = (unsigned char*)addr; - - *baddr = (unsigned char)(value>>8); - *(baddr+1) = (unsigned char)value; -} - -static inline u_int32_t read_long(u_int32_t* addr) -{ - u_int16_t* saddr = (u_int16_t*)addr; - - return ((u_int32_t)read_short(saddr) << 16) | - (u_int32_t)read_short(saddr+1);; -} - -static inline void write_long(u_int32_t* addr, u_int32_t value) -{ - u_int16_t* saddr = (u_int16_t*)addr; - - write_short(saddr, (u_int16_t)(value>>16)); - write_short(saddr+1, (u_int16_t)value); -} -#endif