Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 62966
b: refs/heads/master
c: 60262e5
h: refs/heads/master
v: v3
  • Loading branch information
Al Viro authored and Linus Torvalds committed Jul 26, 2007
1 parent fb8d02a commit 156e8e9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e7cf261b447ed7edbf7c10c046e078bda799afaf
refs/heads/master: 60262e58e305f27d05eefeda172117521514f364
22 changes: 12 additions & 10 deletions trunk/include/asm-arm/unaligned.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,24 +60,24 @@ extern int __bug_unaligned_x(const void *ptr);
__get_unaligned_4_be((__p+4)))

#define __get_unaligned_le(ptr) \
({ \
((__force typeof(*(ptr)))({ \
const __u8 *__p = (const __u8 *)(ptr); \
__builtin_choose_expr(sizeof(*(ptr)) == 1, *__p, \
__builtin_choose_expr(sizeof(*(ptr)) == 2, __get_unaligned_2_le(__p), \
__builtin_choose_expr(sizeof(*(ptr)) == 4, __get_unaligned_4_le(__p), \
__builtin_choose_expr(sizeof(*(ptr)) == 8, __get_unaligned_8_le(__p), \
(void)__bug_unaligned_x(__p))))); \
})
}))

#define __get_unaligned_be(ptr) \
({ \
((__force typeof(*(ptr)))({ \
const __u8 *__p = (const __u8 *)(ptr); \
__builtin_choose_expr(sizeof(*(ptr)) == 1, *__p, \
__builtin_choose_expr(sizeof(*(ptr)) == 2, __get_unaligned_2_be(__p), \
__builtin_choose_expr(sizeof(*(ptr)) == 4, __get_unaligned_4_be(__p), \
__builtin_choose_expr(sizeof(*(ptr)) == 8, __get_unaligned_8_be(__p), \
(void)__bug_unaligned_x(__p))))); \
})
}))


static inline void __put_unaligned_2_le(__u32 __v, register __u8 *__p)
Expand Down Expand Up @@ -131,15 +131,16 @@ static inline void __put_unaligned_8_be(const unsigned long long __v, register _
*/
#define __put_unaligned_le(val,ptr) \
({ \
(void)sizeof(*(ptr) = (val)); \
switch (sizeof(*(ptr))) { \
case 1: \
*(ptr) = (val); \
break; \
case 2: __put_unaligned_2_le((val),(__u8 *)(ptr)); \
case 2: __put_unaligned_2_le((__force u16)(val),(__u8 *)(ptr)); \
break; \
case 4: __put_unaligned_4_le((val),(__u8 *)(ptr)); \
case 4: __put_unaligned_4_le((__force u32)(val),(__u8 *)(ptr)); \
break; \
case 8: __put_unaligned_8_le((val),(__u8 *)(ptr)); \
case 8: __put_unaligned_8_le((__force u64)(val),(__u8 *)(ptr)); \
break; \
default: __bug_unaligned_x(ptr); \
break; \
Expand All @@ -149,15 +150,16 @@ static inline void __put_unaligned_8_be(const unsigned long long __v, register _

#define __put_unaligned_be(val,ptr) \
({ \
(void)sizeof(*(ptr) = (val)); \
switch (sizeof(*(ptr))) { \
case 1: \
*(ptr) = (val); \
break; \
case 2: __put_unaligned_2_be((val),(__u8 *)(ptr)); \
case 2: __put_unaligned_2_be((__force u16)(val),(__u8 *)(ptr)); \
break; \
case 4: __put_unaligned_4_be((val),(__u8 *)(ptr)); \
case 4: __put_unaligned_4_be((__force u32)(val),(__u8 *)(ptr)); \
break; \
case 8: __put_unaligned_8_be((val),(__u8 *)(ptr)); \
case 8: __put_unaligned_8_be((__force u64)(val),(__u8 *)(ptr)); \
break; \
default: __bug_unaligned_x(ptr); \
break; \
Expand Down

0 comments on commit 156e8e9

Please sign in to comment.