00001 #ifndef MINOS_LESTRINGS 00002 #define MINOS_LESTRINGS 00003 00004 // $Id: littleendian_strings.h,v 1.3 2004/04/05 20:09:02 bv Exp $ 00005 // 00006 // Utility functions for translating between an array of little-endian 00007 // long words (i.e. 32 bit values) and an array of characters. 00008 // 00009 // This is necessary because the base type of RawDataBlock is an 00010 // array of Int_t's which transform differently under endianess 00011 // than an array of Char_t's. Since the DAQ is simply copying 00012 // memory from a char string to the location in the raw block, 00013 // following some other data, on a little-endian machine then 00014 // the unpacking code needs to account for this when processed 00015 // on a big-endian machine (e.g. SGI-IRIX). 00016 // 00018 00019 #ifdef R__BYTESWAP 00020 // little endian is the opposite of network order 00021 // while the ROOT's R__BYTESWAP flags cases that are opposite to 00022 // network order so if it is defined then nothing needs to happen 00023 #define minos_letohl(x) (x) 00024 #define minos_htolel(x) (x) 00025 #else 00026 // this section is for architectures with network order 00027 // in this case the code is non-trivial because the packing is 00028 // assumed to be little endian 00029 static UInt_t 00030 UInt_abcd_dcba(UInt_t x) 00031 { 00032 return ( (x << 24) | ((x & 0xff00) << 8) | 00033 ((x >> 8) & 0xff00) | (x >> 24) ); 00034 } 00035 00036 #define minos_letohl(x) UInt_abcd_dcba(x) 00037 #define minos_htolel(x) UInt_abcd_dcba(x) 00038 #endif 00039 00040 UInt_t nwords_in_string(const Char_t* x); 00041 void pack_string_in_lel(Int_t* dest_i ,const Char_t* src_c); 00042 Char_t* unpack_lel_to_string(const Int_t* src_i, UInt_t nwd); 00043 00044 #endif //MINOS_LESTRINGS
1.3.9.1