Changeset 21035
- Timestamp:
- 02/23/08 07:21:55 (9 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
juggler/trunk/modules/vapor/vpr/md/NSPR/SystemNSPR.h
r20974 r21035 46 46 #include <vpr/vprConfig.h> 47 47 48 #include <stdlib.h> 49 #include <string.h> 48 #include <cstdlib> 50 49 #include <string> 51 50 #include <prtime.h> … … 139 138 { 140 139 vpr::Uint64 ret_val; 141 if (isLittleEndian()) 142 { 143 *((vpr::Uint32*)(&ret_val) + 1) = SystemNSPR::Ntohl(*((vpr::Uint32*)(&conversion))); 144 *( ((vpr::Uint32*)(&ret_val))) = SystemNSPR::Ntohl( *( ((vpr::Uint32*)(&conversion))+1) ); 140 141 if ( isLittleEndian() ) 142 { 143 *(reinterpret_cast<vpr::Uint32*>(&ret_val) + 1) = 144 Ntohl(*reinterpret_cast<vpr::Uint32*>(&conversion)); 145 *reinterpret_cast<vpr::Uint32*>(&ret_val) = 146 Ntohl(*(reinterpret_cast<vpr::Uint32*>(&conversion) + 1)); 145 147 } 146 148 else 147 149 { 148 *((vpr::Uint32*)(&ret_val)) = SystemNSPR::Ntohl(*((vpr::Uint32*)(&conversion))); 149 *( ((vpr::Uint32*)(&ret_val)) + 1) = SystemNSPR::Ntohl( *( ((vpr::Uint32*)(&conversion))+1) ); 150 } 150 *reinterpret_cast<vpr::Uint32*>(&ret_val) = 151 Ntohl(*reinterpret_cast<vpr::Uint32*>(&conversion)); 152 *(reinterpret_cast<vpr::Uint32*>(&ret_val) + 1) = 153 Ntohl(*(reinterpret_cast<vpr::Uint32*>(&conversion) + 1)); 154 } 155 151 156 return ret_val; 152 157 } … … 183 188 { 184 189 vpr::Uint64 ret_val; 185 if (isLittleEndian()) 186 { 187 *((vpr::Uint32*)(&ret_val) + 1) = SystemNSPR::Htonl(*((vpr::Uint32*)(&conversion))); 188 *( ((vpr::Uint32*)(&ret_val))) = SystemNSPR::Htonl( *( ((vpr::Uint32*)(&conversion))+1) ); 190 191 if ( isLittleEndian() ) 192 { 193 *(reinterpret_cast<vpr::Uint32*>(&ret_val) + 1) = 194 Htonl(*reinterpret_cast<vpr::Uint32*>(&conversion)); 195 *reinterpret_cast<vpr::Uint32*>(&ret_val) = 196 Htonl(*(reinterpret_cast<vpr::Uint32*>(&conversion) + 1)); 189 197 } 190 198 else 191 199 { 192 *((vpr::Uint32*)(&ret_val)) = SystemNSPR::Htonl(*((vpr::Uint32*)(&conversion))); 193 *( ((vpr::Uint32*)(&ret_val)) + 1) = SystemNSPR::Htonl( *( ((vpr::Uint32*)(&conversion))+1) ); 194 } 200 *reinterpret_cast<vpr::Uint32*>(&ret_val) = 201 Htonl(*reinterpret_cast<vpr::Uint32*>(&conversion)); 202 *(reinterpret_cast<vpr::Uint32*>(&ret_val) + 1) = 203 Htonl(*(reinterpret_cast<vpr::Uint32*>(&conversion) + 1)); 204 } 205 195 206 return ret_val; 196 207 } juggler/trunk/modules/vapor/vpr/md/POSIX/SystemPosix.cpp
r20974 r21035 72 72 { 73 73 vpr::Uint64 ret_val; 74 75 if ( isLittleEndian())74 75 if ( isLittleEndian() ) 76 76 { 77 *((vpr::Uint32*)(&ret_val) + 1) = SystemPosix::Ntohl(*((vpr::Uint32*)(&conversion))); 78 *( ((vpr::Uint32*)(&ret_val))) = SystemPosix::Ntohl( *( ((vpr::Uint32*)(&conversion))+1) ); 77 *(reinterpret_cast<vpr::Uint32*>(&ret_val) + 1) = 78 Ntohl(*reinterpret_cast<vpr::Uint32*>(&conversion)); 79 *reinterpret_cast<vpr::Uint32*>(&ret_val) = 80 Ntohl(*(reinterpret_cast<vpr::Uint32*>(&conversion) + 1)); 79 81 } 80 82 else 81 83 { 82 *((vpr::Uint32*)(&ret_val)) = SystemPosix::Ntohl(*((vpr::Uint32*)(&conversion))); 83 *( ((vpr::Uint32*)(&ret_val)) + 1) = SystemPosix::Ntohl( *( ((vpr::Uint32*)(&conversion))+1) ); 84 *reinterpret_cast<vpr::Uint32*>(&ret_val) = 85 Ntohl(*reinterpret_cast<vpr::Uint32*>(&conversion)); 86 *(reinterpret_cast<vpr::Uint32*>(&ret_val) + 1) = 87 Ntohl(*(reinterpret_cast<vpr::Uint32*>(&conversion) + 1)); 84 88 } 89 85 90 return ret_val; 86 91 } … … 89 94 { 90 95 vpr::Uint64 ret_val; 91 if (isLittleEndian()) 96 97 if ( isLittleEndian() ) 92 98 { 93 *((vpr::Uint32*)(&ret_val) + 1) = SystemPosix::Htonl(*((vpr::Uint32*)(&conversion))); 94 *( ((vpr::Uint32*)(&ret_val))) = SystemPosix::Htonl( *( ((vpr::Uint32*)(&conversion))+1) ); 99 *(reinterpret_cast<vpr::Uint32*>(&ret_val) + 1) = 100 Htonl(*reinterpret_cast<vpr::Uint32*>(&conversion)); 101 *reinterpret_cast<vpr::Uint32*>(&ret_val) = 102 Htonl(*(reinterpret_cast<vpr::Uint32*>(&conversion) + 1)); 95 103 } 96 104 else 97 105 { 98 *((vpr::Uint32*)(&ret_val)) = SystemPosix::Htonl(*((vpr::Uint32*)(&conversion))); 99 *( ((vpr::Uint32*)(&ret_val)) + 1) = SystemPosix::Htonl( *( ((vpr::Uint32*)(&conversion))+1) ); 106 *reinterpret_cast<vpr::Uint32*>(&ret_val) = 107 Htonl(*reinterpret_cast<vpr::Uint32*>(&conversion)); 108 *(reinterpret_cast<vpr::Uint32*>(&ret_val) + 1) = 109 Htonl(*(reinterpret_cast<vpr::Uint32*>(&conversion) + 1)); 100 110 } 111 101 112 return ret_val; 102 113 }
