Changeset 3277 for code/branches/netp6/src
- Timestamp:
- Jul 12, 2009, 7:20:39 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/netp6/src/network/NetworkFunction.h
r3256 r3277 37 37 #include <string> 38 38 #include <boost/preprocessor/cat.hpp> 39 #include <boost/static_assert.hpp> 39 40 40 41 #include "core/OrxonoxClass.h" … … 46 47 { 47 48 48 #if def ORXONOX_COMPILER_GCC49 #if defined(ORXONOX_COMPILER_GCC) && defined(ORXONOX_ARCH_32) 49 50 static const unsigned int MAX_FUNCTION_POINTER_SIZE = 8; 50 #else //ORXONOX_COMPILER_GCC51 #else 51 52 static const unsigned int MAX_FUNCTION_POINTER_SIZE = 16; 52 53 #endif //ORXONOX_COMPILER_GCC … … 57 58 bool operator<(const NetworkFunctionPointer& b) const 58 59 { 59 #if def ORXONOX_COMPILER_GCC60 #if defined(ORXONOX_COMPILER_GCC) && defined(ORXONOX_ARCH_32) 60 61 return pointer[0]<b.pointer[0] ? true : pointer[1]<b.pointer[1]; 61 62 #else //ORXONOX_COMPILER_GCC … … 195 196 template<class T> inline void copyPtr( T ptr, NetworkFunctionPointer& destptr) 196 197 { 197 memset((uint8_t*)&destptr + sizeof(T), 0, sizeof(NetworkFunctionPointer)-sizeof(T)); 198 if( sizeof(NetworkFunctionPointer)-sizeof(T) > 0) 199 memset((uint8_t*)&destptr + sizeof(T), 0, sizeof(NetworkFunctionPointer)-sizeof(T)); 198 200 T p2 = ptr; 199 201 memcpy( &destptr, &p2, sizeof(T) ); … … 204 206 template<class T> inline void* registerStaticNetworkFunctionFct( T ptr, const std::string& name ) 205 207 { 208 BOOST_STATIC_ASSERT( sizeof(T)<=sizeof(NetworkFunctionPointer) ); // if this fails your compiler uses bigger pointers for static functions than defined above 206 209 NetworkFunctionPointer destptr; 207 210 copyPtr( ptr, destptr ); … … 212 215 template<class T, class PT> inline void* registerMemberNetworkFunctionFct( PT ptr, const std::string& name ) 213 216 { 217 BOOST_STATIC_ASSERT( sizeof(PT)<=sizeof(NetworkFunctionPointer) ); // if this fails your compiler uses bigger pointers for a specific kind of member functions than defined above 214 218 NetworkFunctionPointer destptr; 215 219 copyPtr( ptr, destptr );
Note: See TracChangeset
for help on using the changeset viewer.