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

Function getElement

src/Bullet3Serialize/Bullet2FileLoader/b3File.cpp:784–818  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

782
783// ----------------------------------------------------- //
784static void getElement(int arrayLen, const char *cur, const char *old, char *oldPtr, char *curData)
785{
786#define b3GetEle(value, current, type, cast, size, ptr) \
787 if (strcmp(current, type) == 0) \
788 { \
789 value = (*(cast *)ptr); \
790 ptr += size; \
791 }
792
793#define b3SetEle(value, current, type, cast, size, ptr) \
794 if (strcmp(current, type) == 0) \
795 { \
796 (*(cast *)ptr) = (cast)value; \
797 ptr += size; \
798 }
799 double value = 0.0;
800
801 for (int i = 0; i < arrayLen; i++)
802 {
803 b3GetEle(value, old, "char", char, sizeof(char), oldPtr);
804 b3SetEle(value, cur, "char", char, sizeof(char), curData);
805 b3GetEle(value, old, "short", short, sizeof(short), oldPtr);
806 b3SetEle(value, cur, "short", short, sizeof(short), curData);
807 b3GetEle(value, old, "ushort", unsigned short, sizeof(unsigned short), oldPtr);
808 b3SetEle(value, cur, "ushort", unsigned short, sizeof(unsigned short), curData);
809 b3GetEle(value, old, "int", int, sizeof(int), oldPtr);
810 b3SetEle(value, cur, "int", int, sizeof(int), curData);
811 b3GetEle(value, old, "long", int, sizeof(int), oldPtr);
812 b3SetEle(value, cur, "long", int, sizeof(int), curData);
813 b3GetEle(value, old, "float", float, sizeof(float), oldPtr);
814 b3SetEle(value, cur, "float", float, sizeof(float), curData);
815 b3GetEle(value, old, "double", double, sizeof(double), oldPtr);
816 b3SetEle(value, cur, "double", double, sizeof(double), curData);
817 }
818}
819
820// ----------------------------------------------------- //
821void 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