include/sysdep.h
changeset 200 930be51ddc24
equal deleted inserted replaced
199:48b59c852636 200:930be51ddc24
       
     1 #ifndef __sysdep_h__
       
     2 #define __sysdep_h__
       
     3 
       
     4 #include "config.h"
       
     5 
       
     6 #ifdef CANOPEN_BIG_ENDIAN
       
     7 
       
     8 /* Warning: the argument must not update pointers, e.g. *p++ */
       
     9 
       
    10 #define UNS16_LE(v)  ((((UNS16)(v) & 0xff00) >> 8) | \
       
    11 		      (((UNS16)(v) & 0x00ff) << 8))
       
    12 
       
    13 #define UNS32_LE(v)  ((((UNS32)(v) & 0xff000000) >> 24) |	\
       
    14 		      (((UNS32)(v) & 0x00ff0000) >> 8)  |	\
       
    15 		      (((UNS32)(v) & 0x0000ff00) << 8)  |	\
       
    16 		      (((UNS32)(v) & 0x000000ff) << 24))
       
    17 
       
    18 #else
       
    19 
       
    20 #define UNS16_LE(v)  (v)
       
    21 
       
    22 #define UNS32_LE(v)  (v)
       
    23 
       
    24 #endif
       
    25 
       
    26 #endif /* __sysdep_h__ */
       
    27