From 413f560bf6f6c38fe141e3cab3c81996db83045b Mon Sep 17 00:00:00 2001 From: midipix Date: Thu, 3 Dec 2015 23:20:19 -0500 Subject: internal headers: rename perk_impl.h to perk_reader_impl.h --- src/internal/perk_impl.h | 50 ------------------------------------------------ 1 file changed, 50 deletions(-) delete mode 100644 src/internal/perk_impl.h (limited to 'src/internal/perk_impl.h') diff --git a/src/internal/perk_impl.h b/src/internal/perk_impl.h deleted file mode 100644 index bda7581..0000000 --- a/src/internal/perk_impl.h +++ /dev/null @@ -1,50 +0,0 @@ -#ifndef PERK_IMPL_H -#define PERK_IMPL_H - -#include -#include - -#if (BYTE_ORDER == LITTLE_ENDIAN) - -static inline uint16_t pe_read_short(const unsigned char * raw) -{ - return *(uint16_t *)raw; -} - -static inline uint32_t pe_read_long(const unsigned char * raw) -{ - return *(uint32_t *)raw; -} - -static inline uint64_t pe_read_quad(const unsigned char * raw) -{ - return *(uint64_t *)raw; -} - -#else - -static inline uint16_t pe_read_short(const unsigned char * raw) -{ - uint16_t x = *(uint16_t *)raw; - return x<<8 | x>>8; -} - -static inline uint32_t pe_swap_long(uint32_t x) -{ - return x<<24 | (x<<8) & 0xff0000 | (x>>8) & 0xff00 | x>>24; -} - -static inline uint32_t pe_read_long(const unsigned char * raw) -{ - return pe_swap_long(*(uint32_t *)raw); -} - -static inline uint64_t pe_read_quad(const unsigned char * raw) -{ - uint64_t x = *(uint64_t *)raw; - return ((uint64_t)pe_swap_long(x)<<32) | pe_swap_long(x>>32); -} - -#endif - -#endif -- cgit v1.2.3