gwnavruntime/database/stitchdatamanagerutils.h Source File
Go to the documentation of this file.
9 #ifndef Navigation_StitchDataManagerUtils_H
10 #define Navigation_StitchDataManagerUtils_H
18 class MemoryManagerUtils
24 static bool IsMemoryAlignedForClass(T* memory)
26 return IsMemoryAlignedForClassFromClassSize<(KyUInt32)sizeof(T)>((
char*)memory);
30 static KyUInt32 GetPaddingForMemory(
char* memory)
32 return GetPaddingForMemoryFromClassSize<(KyUInt32)sizeof(T)>(memory);
38 return GetPaddingForBytesCountFromClassSize<(KyUInt32)sizeof(T)>((UPInt)currentBytesCount);
41 template<KyUInt32 sizeOfClass>
42 static inline bool IsMemoryAlignedForClassFromClassSize(
char* memory)
44 return GetPaddingForMemoryFromClassSize<sizeOfClass>(memory) == 0;
47 template<KyUInt32 sizeOfClass>
48 static inline KyUInt32 GetPaddingForMemoryFromClassSize(
char* memory)
50 return GetPaddingForBytesCountFromClassSize<sizeOfClass>((UPInt)memory);
53 template<KyUInt32 sizeOfClass>
54 static inline KyUInt32 GetPaddingForBytesCountFromClassSize(UPInt currentBytesCount)
56 if ((sizeOfClass & 0x1) != 0)
59 else if ((sizeOfClass & 0x2) != 0)
62 return (
KyUInt32)(currentBytesCount & 0x1);
65 #ifndef KY_64BIT_POINTERS
68 return (
KyUInt32)((4 - (currentBytesCount & 0x3)) & 0x3);
70 if ((sizeOfClass & 0x4) != 0)
72 return (
KyUInt32)((4 - (currentBytesCount & 0x3)) & 0x3);
75 return (
KyUInt32)((8 - (currentBytesCount & 0x7)) & 0x7);
87 #endif //Navigation_StitchDataManagerUtils_H
Definition: gamekitcrowddispersion.h:20
unsigned int KyUInt32
Type used internally to represent an unsigned 32-bit integer.
Definition: types.h:36