From 43e67213704bfbc638eec70a87001f7c69c33447 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sun, 23 Jan 2005 14:35:11 +0000 Subject: Remove sdp_{get|put}_unaligned definition --- include/sdp_internal.h | 97 -------------------------------------------------- 1 file changed, 97 deletions(-) diff --git a/include/sdp_internal.h b/include/sdp_internal.h index 5d6ed7f9..2e0e343b 100644 --- a/include/sdp_internal.h +++ b/include/sdp_internal.h @@ -55,103 +55,6 @@ extern "C" { #define SDP_UUID_SEQ_SIZE 256 #define SDP_MAX_ATTR_LEN 65535 -/* - * SDP unaligned access. - * based on linux/asm-/unaligned.h - */ -#if defined(__i386__) - -#define sdp_get_unaligned(ptr) (*(ptr)) -#define sdp_put_unaligned(val, ptr) ((void)( *(ptr) = (val) )) - -#else - -struct __una_u64 { uint64_t x; } __attribute__((packed)); -struct __una_u32 { uint32_t x; } __attribute__((packed)); -struct __una_u16 { uint16_t x; } __attribute__((packed)); - -static inline unsigned long long __uldq(const unsigned long *r11) -{ - const struct __una_u64 *ptr = (const struct __una_u64 *) r11; - return ptr->x; -} - -static inline unsigned long __uldl(const unsigned int * r11) -{ - const struct __una_u32 *ptr = (const struct __una_u32 *) r11; - return ptr->x; -} - -static inline unsigned long __uldw(const unsigned short * r11) -{ - const struct __una_u16 *ptr = (const struct __una_u16 *) r11; - return ptr->x; -} - -static inline void __ustq(unsigned long r5, unsigned long * r11) -{ - struct __una_u64 *ptr = (struct __una_u64 *) r11; - ptr->x = r5; -} - -static inline void __ustl(unsigned long r5, unsigned int * r11) -{ - struct __una_u32 *ptr = (struct __una_u32 *) r11; - ptr->x = r5; -} - -static inline void __ustw(unsigned long r5, unsigned short * r11) -{ - struct __una_u16 *ptr = (struct __una_u16 *) r11; - ptr->x = r5; -} - -static inline unsigned long long __sdp_get_unaligned(const void *ptr, size_t size) -{ - unsigned long long val = 0; - switch (size) { - case 1: - val = *(const unsigned char *)ptr; - break; - case 2: - val = __uldw((const unsigned short *)ptr); - break; - case 4: - val = __uldl((const unsigned int *)ptr); - break; - case 8: - val = __uldq((const unsigned long *)ptr); - break; - } - return val; -} - -static inline void __sdp_put_unaligned(unsigned long val, void *ptr, size_t size) -{ - switch (size) { - case 1: - *(unsigned char *)ptr = (val); - break; - case 2: - __ustw(val, (unsigned short *)ptr); - break; - case 4: - __ustl(val, (unsigned int *)ptr); - break; - case 8: - __ustq(val, (unsigned long *)ptr); - break; - } -} - -#define sdp_get_unaligned(ptr) \ - ((__typeof__(*(ptr)))__sdp_get_unaligned((ptr), sizeof(*(ptr)))) - -#define sdp_put_unaligned(x,ptr) \ - __sdp_put_unaligned((unsigned long)(x), (ptr), sizeof(*(ptr))) - -#endif - #if __BYTE_ORDER == __BIG_ENDIAN #define ntoh64(x) x static inline void ntoh128(uint128_t *src, uint128_t *dst) -- cgit