Re: [ROOT] Byteswap.h

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Fri Nov 08 2002 - 11:08:09 MET


These macros are used to do the byteswapping not to find out if the
system byteswaps. In the ROOT case the knowledge which platform
byteswaps is encoded in the RConfig.h file, macro R__BYTESWAP.

Cheers, Fons.


On Fri, 2002-11-08 at 10:36, giuseppe.foggi@libero.it wrote:
> Hi,
>  I have some problem with Byteswap.h.
>  
>  What is the mean about the lines 
>  
>  #define R__bswap_constant_16(x) \
>      ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8))
>  
>  #if defined __GNUC__ && __GNUC__ >= 2
>  # define R__bswap_16(x) \
>     
>  (__extension__                                                          
>  \
>       ({ register unsigned short int
>  __v;                                     \
>          if (__builtin_constant_p
>  (x))                                        \
>            __v = R__bswap_constant_16
>  (x);                                     \
>         
>  else                                                                 \
>            __asm__ __volatile__ ("rorw $8,
>  %w0"                               \
>                                  : "=r"
>  (__v)                                 \
>                                  : "0" ((unsigned short int)
>  (x))             \
>                                  :
>  "cc");                                     \
>          __v; }))
>  
>  
>  I understood that Byteswap.h is used to convert big endian
>  rappresentation to little endian rappresentation and viceversa, so I can
>  know which rappresentation is used by my system?
>  For my project I need know the value of R__bswap_xx()before to compile
>  the source which uses this headers file (Byteswap.h)   
>  My system is AMD Atholn 1GHz 
>  Thank you.
>  Bye. 
>  Giuseppe.
>  
>  
>  
-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7679480



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:16 MET