From: Christian P. <cp...@us...> - 2005-07-03 23:40:35
|
Update of /cvsroot/pclasses/pclasses2/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13625/src Modified Files: ByteOrderTraits.cpp Log Message: - Added missing ByteOrderTraits Index: ByteOrderTraits.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/ByteOrderTraits.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- ByteOrderTraits.cpp 22 Dec 2004 17:54:34 -0000 1.1.1.1 +++ ByteOrderTraits.cpp 3 Jul 2005 23:40:26 -0000 1.2 @@ -55,6 +55,88 @@ } #endif +void ByteOrderTraits<int8_t>:: + setLittleEndian(int8_t& cpuVal, int8_t newValLE) throw() +{ + cpuVal = newValLE; +} + +int8_t ByteOrderTraits<int8_t>::littleEndian(int8_t cpuVal) throw() +{ + return cpuVal; +} + +void ByteOrderTraits<int8_t>:: + setBigEndian(int8_t& cpuVal, int8_t newValBE) throw() +{ + cpuVal = newValBE; +} + +int8_t ByteOrderTraits<int8_t>::bigEndian(int8_t cpuVal) throw() +{ + return cpuVal; +} + +void ByteOrderTraits<uint8_t>:: + setLittleEndian(uint8_t& cpuVal, uint8_t newValLE) throw() +{ + cpuVal = newValLE; +} + +uint8_t ByteOrderTraits<uint8_t>::littleEndian(uint8_t cpuVal) throw() +{ + return cpuVal; +} + +void ByteOrderTraits<uint8_t>:: + setBigEndian(uint8_t& cpuVal, uint8_t newValBE) throw() +{ + cpuVal = newValBE; +} + +uint8_t ByteOrderTraits<uint8_t>::bigEndian(uint8_t cpuVal) throw() +{ + return cpuVal; +} + +void ByteOrderTraits<int16_t>:: + setLittleEndian(int16_t& cpuVal, int16_t newValLE) throw() +{ + #ifdef PCLASSES_WORDS_BIGENDIAN + cpuVal = (int16_t)swab16((uint16_t)newValLE); + #else + cpuVal = newValLE; + #endif +} + +int16_t ByteOrderTraits<int16_t>::littleEndian(int16_t cpuVal) throw() +{ + #ifdef PCLASSES_WORDS_BIGENDIAN + return (int16_t)swab16((uint16_t)cpuVal); + #else + return cpuVal; + #endif +} + +void ByteOrderTraits<int16_t>:: + setBigEndian(int16_t& cpuVal, int16_t newValBE) throw() +{ + #ifdef PCLASSES_WORDS_BIGENDIAN + cpuVal = newValBE; + #else + cpuVal = (int16_t)swab16((uint16_t)newValBE); + #endif +} + +int16_t ByteOrderTraits<int16_t>::bigEndian(int16_t cpuVal) throw() +{ + #ifdef PCLASSES_WORDS_BIGENDIAN + return cpuVal; + #else + return (int16_t)swab16((uint16_t)cpuVal); + #endif +} + void ByteOrderTraits<uint16_t>:: setLittleEndian(uint16_t& cpuVal, uint16_t newValLE) throw() { @@ -93,6 +175,44 @@ #endif } +void ByteOrderTraits<int32_t>:: + setLittleEndian(int32_t& cpuVal, int32_t newValLE) throw() +{ + #ifdef PCLASSES_WORDS_BIGENDIAN + cpuVal = (int32_t)swab32((uint32_t)newValLE); + #else + cpuVal = newValLE; + #endif +} + +int32_t ByteOrderTraits<int32_t>::littleEndian(int32_t cpuVal) throw() +{ + #ifdef PCLASSES_WORDS_BIGENDIAN + return (int32_t)swab32((uint32_t)cpuVal); + #else + return cpuVal; + #endif +} + +void ByteOrderTraits<int32_t>:: + setBigEndian(int32_t& cpuVal, int32_t newValBE) throw() +{ + #ifdef PCLASSES_WORDS_BIGENDIAN + cpuVal = newValBE; + #else + cpuVal = (int32_t)swab32((uint32_t)newValBE); + #endif +} + +int32_t ByteOrderTraits<int32_t>::bigEndian(int32_t cpuVal) throw() +{ + #ifdef PCLASSES_WORDS_BIGENDIAN + return cpuVal; + #else + return (int32_t)swab32((uint32_t)cpuVal); + #endif +} + void ByteOrderTraits<uint32_t>:: setLittleEndian(uint32_t& cpuVal, uint32_t newValLE) throw() { @@ -133,6 +253,44 @@ #ifdef PCLASSES_HAVE_64BIT_INT +void ByteOrderTraits<int64_t>:: + setLittleEndian(int64_t& cpuVal, int64_t newValLE) throw() +{ + #ifdef PCLASSES_WORDS_BIGENDIAN + cpuVal = (int64_t)swab64((uint64_t)newValLE); + #else + cpuVal = newValLE; + #endif +} + +int64_t ByteOrderTraits<int64_t>::littleEndian(int64_t cpuVal) throw() +{ + #ifdef PCLASSES_WORDS_BIGENDIAN + return (int64_t)swab64((uint64_t)cpuVal); + #else + return cpuVal; + #endif +} + +void ByteOrderTraits<int64_t>:: + setBigEndian(int64_t& cpuVal, int64_t newValBE) throw() +{ + #ifdef PCLASSES_WORDS_BIGENDIAN + cpuVal = newValBE; + #else + cpuVal = (int64_t)swab64((uint64_t)newValBE); + #endif +} + +int64_t ByteOrderTraits<int64_t>::bigEndian(int64_t cpuVal) throw() +{ + #ifdef PCLASSES_WORDS_BIGENDIAN + return cpuVal; + #else + return (int64_t)swab64((uint64_t)cpuVal); + #endif +} + void ByteOrderTraits<uint64_t>:: setLittleEndian(uint64_t& cpuVal, uint64_t newValLE) throw() { |