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

Method initCmpFlags

Extras/Serialize/BulletFileLoader/bDNA.cpp:164–253  ·  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)); //DNA empty!
170
171 mCMPFlags.resize(mStructs.size(), FDF_NONE);
172
173 int i;
174 for (i = 0; i < (int)mStructs.size(); i++)
175 {
176 short *oldStruct = mStructs[i];
177
178 int oldLookup = getReverseType(oldStruct[0]);
179 if (oldLookup == -1)
180 {
181 mCMPFlags[i] = FDF_NONE;
182 continue;
183 }
184 //char* typeName = mTypes[oldStruct[0]];
185
186//#define SLOW_FORWARD_COMPATIBLE 1
187#ifdef SLOW_FORWARD_COMPATIBLE
188 char *typeName = mTypes[oldLookup];
189 int newLookup = memDNA->getReverseType(typeName);
190 if (newLookup == -1)
191 {
192 mCMPFlags[i] = FDF_NONE;
193 continue;
194 }
195 short *curStruct = memDNA->mStructs[newLookup];
196#else
197 // memory for file
198
199 if (oldLookup < memDNA->mStructs.size())
200 {
201 short *curStruct = memDNA->mStructs[oldLookup];
202#endif
203
204 // rebuild...
205 mCMPFlags[i] = FDF_STRUCT_NEQU;
206
207#ifndef TEST_BACKWARD_FORWARD_COMPATIBILITY
208
209 if (curStruct[1] == oldStruct[1])
210 {
211 // type len same ...
212 if (mTlens[oldStruct[0]] == memDNA->mTlens[curStruct[0]])
213 {
214 bool isSame = true;
215 int elementLength = oldStruct[1];
216
217 curStruct += 2;
218 oldStruct += 2;
219
220 for (int j = 0; j < elementLength; j++, curStruct += 2, oldStruct += 2)
221 {

Callers 1

parseInternalMethod · 0.45

Calls 3

sizeMethod · 0.45
resizeMethod · 0.45
getReverseTypeMethod · 0.45

Tested by

no test coverage detected