MCPcopy Create free account
hub / github.com/GaijinEntertainment/daScript / getTupleFieldOffset

Function getTupleFieldOffset

src/simulate/debug_info.cpp:248–264  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

246 }
247
248 int getTupleFieldOffset ( TypeInfo * info, int index ) {
249 DAS_ASSERT(info->type==Type::tTuple);
250 DAS_ASSERT(uint32_t(index)<info->argCount);
251 int size = 0, idx = 0;
252 for (int i = 0, n = (int)info->argCount; i != n; ++i) {
253 TypeInfo * argT = info->argTypes[i];
254 int al = getTypeAlign(argT) - 1;
255 size = (size + al) & ~al;
256 if ( idx==index ) {
257 return size;
258 }
259 size += getTypeSize(argT);
260 idx ++;
261 }
262 DAS_ASSERT(0 && "we should not even be here. field index out of range somehow???");
263 return -1;
264 }
265
266 static int getVariantAlign ( TypeInfo * info ) {
267 int al = getTypeBaseAlign(Type::tInt);

Callers 2

scanTupleMethod · 0.85

Calls 2

getTypeAlignFunction · 0.85
getTypeSizeFunction · 0.85

Tested by

no test coverage detected