bitfields: use "type" parameter for unit pointer type
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 5 May 2011 16:39:42 +0000 (12:39 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 5 May 2011 16:39:42 +0000 (12:39 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
include/babeltrace/bitfield.h

index 84a9679003e32de0d8fc29b3591fab230fb07bba..df8ab0b2b67a224bed60a9b86d866494a288f37f 100644 (file)
@@ -79,7 +79,7 @@
 #define _bt_bitfield_write_le(_ptr, type, _start, _length, _v)         \
 do {                                                                   \
        typeof(_v) __v = (_v);                                          \
-       typeof(*(_ptr)) *__ptr = (_ptr);                                \
+       type *__ptr = (void *) (_ptr);                                  \
        unsigned long __start = (_start), __length = (_length);         \
        type mask, cmask;                                               \
        unsigned long ts = sizeof(type) * CHAR_BIT; /* type size */     \
@@ -138,7 +138,7 @@ do {                                                                        \
 #define _bt_bitfield_write_be(_ptr, type, _start, _length, _v)         \
 do {                                                                   \
        typeof(_v) __v = (_v);                                          \
-       typeof(*(_ptr)) *__ptr = (_ptr);                                \
+       type *__ptr = (void *) (_ptr);                                  \
        unsigned long __start = (_start), __length = (_length);         \
        type mask, cmask;                                               \
        unsigned long ts = sizeof(type) * CHAR_BIT; /* type size */     \
@@ -231,8 +231,8 @@ do {                                                                        \
 #define _bt_bitfield_read_le(_ptr, type, _start, _length, _vptr)       \
 do {                                                                   \
        typeof(*(_vptr)) *__vptr = (_vptr);                             \
-       typeof(*(_ptr)) *__ptr = (_ptr);                                \
        typeof(*__vptr) __v;                                            \
+       type *__ptr = (void *) (_ptr);                                  \
        unsigned long __start = (_start), __length = (_length);         \
        type mask, cmask;                                               \
        unsigned long ts = sizeof(type) * CHAR_BIT; /* type size */     \
@@ -298,8 +298,8 @@ do {                                                                        \
 #define _bt_bitfield_read_be(_ptr, type, _start, _length, _vptr)       \
 do {                                                                   \
        typeof(*(_vptr)) *__vptr = (_vptr);                             \
-       typeof(*(_ptr)) *__ptr = (_ptr);                                \
        typeof(*__vptr) __v;                                            \
+       type *__ptr = (void *) (_ptr);                                  \
        unsigned long __start = (_start), __length = (_length);         \
        type mask, cmask;                                               \
        unsigned long ts = sizeof(type) * CHAR_BIT; /* type size */     \
This page took 0.024637 seconds and 4 git commands to generate.