defs.h   defs.h 
#ifndef _LIBHX_DEFS_H #ifndef _LIBHX_DEFS_H
#define _LIBHX_DEFS_H 1 #define _LIBHX_DEFS_H 1
#ifdef __cplusplus #ifdef __cplusplus
# if defined(__GNUC__) && !defined(offsetof) # if defined(__GNUC__) && !defined(offsetof)
# define offsetof(type, member) __builtin_offsetof(type, membe r) # define offsetof(type, member) __builtin_offsetof(type, membe r)
# endif # endif
# ifndef offsetof # ifndef offsetof
# define reinterpret_cast<long>(&(static_cast<type *>(NULL)->m # define offsetof(type, member) \
ember)) reinterpret_cast<long>(&(static_cast<type *>(NULL)->
member))
# endif # endif
# ifndef containerof # ifndef containerof
# define containerof(var, type, member) reinterpret_cast<type *>( \ # define containerof(var, type, member) reinterpret_cast<type *>( \
reinterpret_cast<char *>(var) - offsetof(type, membe r)) reinterpret_cast<char *>(var) - offsetof(type, membe r))
# endif # endif
template<typename new_type> template<typename new_type>
static inline new_type signed_cast(const char *expr) static inline new_type signed_cast(const char *expr)
{ {
return reinterpret_cast<new_type>(expr); return reinterpret_cast<new_type>(expr);
skipping to change at line 79 skipping to change at line 80
) )
# if defined(__GNUC__) && !defined(signed_cast) # if defined(__GNUC__) && !defined(signed_cast)
# define signed_cast(type, expr) ({ \ # define signed_cast(type, expr) ({ \
BUILD_BUG_ON(!__signed_cast_compatible(typeof(type), typeof(expr))); \ BUILD_BUG_ON(!__signed_cast_compatible(typeof(type), typeof(expr))); \
(type)(expr); \ (type)(expr); \
}) })
# endif # endif
# if defined(__GNUC__) && !defined(static_cast) # if defined(__GNUC__) && !defined(static_cast)
# define static_cast(type, expr) \ # define static_cast(type, expr) \
((struct { type x; }){expr}.x) ((struct { type x; }){(expr)}.x)
# endif # endif
# if defined(__GNUC__) && !defined(const_cast1) # if defined(__GNUC__) && !defined(const_cast1)
# define __const_cast_strip1(expr) \ # define __const_cast_strip1(expr) \
typeof(*(struct { typeof(expr) x; }){0}.x) typeof(*(struct { typeof(expr) x; }){0}.x)
# define __const_cast_strip2(expr) \ # define __const_cast_strip2(expr) \
typeof(**(struct { typeof(expr) x; }){0}.x) typeof(**(struct { typeof(expr) x; }){0}.x)
# define __const_cast_strip3(expr) \ # define __const_cast_strip3(expr) \
typeof(***(struct { typeof(expr) x; }){0}.x) typeof(***(struct { typeof(expr) x; }){0}.x)
# define const_cast1(new_type, expr) ({ \ # define const_cast1(new_type, expr) ({ \
BUILD_BUG_ON(!__builtin_types_compatible_p(__const_c ast_strip1(expr), __const_cast_strip1(new_type))); \ BUILD_BUG_ON(!__builtin_types_compatible_p(__const_c ast_strip1(expr), __const_cast_strip1(new_type))); \
skipping to change at line 117 skipping to change at line 118
# ifndef const_cast # ifndef const_cast
# define const_cast(type, expr) ((type)(expr)) # define const_cast(type, expr) ((type)(expr))
# endif # endif
# ifndef reinterpret_cast # ifndef reinterpret_cast
# define reinterpret_cast(type, expr) ((type)(expr)) # define reinterpret_cast(type, expr) ((type)(expr))
# endif # endif
# if defined(__GNUC__) && !defined(offsetof) # if defined(__GNUC__) && !defined(offsetof)
# define offsetof(type, member) __builtin_offsetof(type, membe r) # define offsetof(type, member) __builtin_offsetof(type, membe r)
# endif # endif
# ifndef offsetof # ifndef offsetof
# define reinterpret_cast(long, &(static_cast(type *, NULL)->m # define offsetof(type, member) \
ember)) reinterpret_cast(long, &(static_cast(type *, NULL)->
member))
# endif # endif
# ifndef containerof # ifndef containerof
# define containerof(var, type, member) reinterpret_cast(type *, \ # define containerof(var, type, member) reinterpret_cast(type *, \
reinterpret_cast(char *, var) - offsetof(type, membe r)) reinterpret_cast(char *, var) - offsetof(type, membe r))
# endif # endif
#endif #endif
#ifndef ARRAY_SIZE #ifndef ARRAY_SIZE
# define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x))) # define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x)))
#endif #endif
 End of changes. 3 change blocks. 
5 lines changed or deleted 7 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/