MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / insert

Method insert

Engine/source/ts/tsIntegerSet.cpp:219–245  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

217}
218
219void TSIntegerSet::insert(S32 index, bool value)
220{
221 AssertFatal(index<MAX_TS_SET_SIZE,"TSIntegerSet::insert: out of range");
222
223 // shift bits in words after the insertion point
224 U32 endWord = (end() >> 5) + 1;
225 if (endWord >= MAX_TS_SET_DWORDS)
226 endWord = MAX_TS_SET_DWORDS-1;
227
228 for (S32 i = endWord; i > (index >> 5); i--)
229 {
230 bits[i] = bits[i] << 1;
231 if (bits[i-1] & 0x80000000)
232 bits[i] |= 0x1;
233 }
234
235 // shift to create space in target word
236 U32 lowMask = (1 << (index & 0x1f)) - 1; // bits below the insert point
237 U32 highMask = ~(lowMask | (1 << (index & 0x1f))); // bits above the insert point
238
239 S32 word = index >> 5;
240 bits[word] = ((bits[word] << 1) & highMask) | (bits[word] & lowMask);
241
242 // insert new value
243 if (value)
244 set(index);
245}
246
247void TSIntegerSet::erase(S32 index)
248{

Callers 15

createEmptyShapeMethod · 0.45
CommandMethod · 0.45
addSequenceFromFieldMethod · 0.45
buildConvexHullMethod · 0.45
addNameMethod · 0.45
addDetailMethod · 0.45
addImposterMethod · 0.45
addNodeMethod · 0.45
addObjectMethod · 0.45
addMeshToObjectMethod · 0.45
_PadMoveAndTrimFunction · 0.45

Calls 2

endFunction · 0.85
setFunction · 0.50

Tested by

no test coverage detected