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

Method initCmpFlags

src/Bullet3Serialize/Bullet2FileLoader/b3DNA.cpp:164–252  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

162
163// ----------------------------------------------------- //
164void bDNA::initCmpFlags(bDNA *memDNA)
165{
166 // compare the file to memory
167 // this ptr should be the file data
168
169 assert(!(m_Names.size() == 0)); // && "SDNA empty!");
170 mCMPFlags.resize(mStructs.size(), FDF_NONE);
171
172 int i;
173 for (i = 0; i < (int)mStructs.size(); i++)
174 {
175 short *oldStruct = mStructs[i];
176
177 int oldLookup = getReverseType(oldStruct[0]);
178 if (oldLookup == -1)
179 {
180 mCMPFlags[i] = FDF_NONE;
181 continue;
182 }
183 //char* typeName = mTypes[oldStruct[0]];
184
185//#define SLOW_FORWARD_COMPATIBLE 1
186#ifdef SLOW_FORWARD_COMPATIBLE
187 char *typeName = mTypes[oldLookup];
188 int newLookup = memDNA->getReverseType(typeName);
189 if (newLookup == -1)
190 {
191 mCMPFlags[i] = FDF_NONE;
192 continue;
193 }
194 short *curStruct = memDNA->mStructs[newLookup];
195#else
196 // memory for file
197
198 if (oldLookup < memDNA->mStructs.size())
199 {
200 short *curStruct = memDNA->mStructs[oldLookup];
201#endif
202
203 // rebuild...
204 mCMPFlags[i] = FDF_STRUCT_NEQU;
205
206#ifndef TEST_BACKWARD_FORWARD_COMPATIBILITY
207
208 if (curStruct[1] == oldStruct[1])
209 {
210 // type len same ...
211 if (mTlens[oldStruct[0]] == memDNA->mTlens[curStruct[0]])
212 {
213 bool isSame = true;
214 int elementLength = oldStruct[1];
215
216 curStruct += 2;
217 oldStruct += 2;
218
219 for (int j = 0; j < elementLength; j++, curStruct += 2, oldStruct += 2)
220 {
221 // type the same

Callers 1

parseInternalMethod · 0.45

Calls 3

sizeMethod · 0.45
resizeMethod · 0.45
getReverseTypeMethod · 0.45

Tested by

no test coverage detected