MCPcopy Create free account
hub / github.com/bulletphysics/bullet3 / getElement

Function getElement

Extras/Serialize/BulletFileLoader/bFile.cpp:817–851  ·  view source on GitHub ↗

----------------------------------------------------- //

Source from the content-addressed store, hash-verified

815
816// ----------------------------------------------------- //
817static void getElement(int arrayLen, const char *cur, const char *old, char *oldPtr, char *curData)
818{
819#define getEle(value, current, type, cast, size, ptr) \
820 if (strcmp(current, type) == 0) \
821 { \
822 value = (*(cast *)ptr); \
823 ptr += size; \
824 }
825
826#define setEle(value, current, type, cast, size, ptr) \
827 if (strcmp(current, type) == 0) \
828 { \
829 (*(cast *)ptr) = (cast)value; \
830 ptr += size; \
831 }
832 double value = 0.0;
833
834 for (int i = 0; i < arrayLen; i++)
835 {
836 getEle(value, old, "char", char, sizeof(char), oldPtr);
837 setEle(value, cur, "char", char, sizeof(char), curData);
838 getEle(value, old, "short", short, sizeof(short), oldPtr);
839 setEle(value, cur, "short", short, sizeof(short), curData);
840 getEle(value, old, "ushort", unsigned short, sizeof(unsigned short), oldPtr);
841 setEle(value, cur, "ushort", unsigned short, sizeof(unsigned short), curData);
842 getEle(value, old, "int", int, sizeof(int), oldPtr);
843 setEle(value, cur, "int", int, sizeof(int), curData);
844 getEle(value, old, "long", int, sizeof(int), oldPtr);
845 setEle(value, cur, "long", int, sizeof(int), curData);
846 getEle(value, old, "float", float, sizeof(float), oldPtr);
847 setEle(value, cur, "float", float, sizeof(float), curData);
848 getEle(value, old, "double", double, sizeof(double), oldPtr);
849 setEle(value, cur, "double", double, sizeof(double), curData);
850 }
851}
852
853// ----------------------------------------------------- //
854void bFile::swapData(char *data, short type, int arraySize, bool ignoreEndianFlag)

Callers 2

getMatchingFileDNAMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected