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

Method getTupleFieldOffset

src/ast/ast_typedecl.cpp:2893–2908  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2891 }
2892
2893 int TypeDecl::getTupleFieldOffset ( int index ) const {
2894 DAS_ASSERT(baseType==Type::tTuple);
2895 DAS_ASSERT(index>=0 && index<int(argTypes.size()));
2896 int size = 0, idx = 0;
2897 for ( const auto & argT : argTypes ) {
2898 int al = argT->getAlignOf() - 1;
2899 size = (size + al) & ~al;
2900 if ( idx==index ) {
2901 return size;
2902 }
2903 size += argT->getSizeOf();
2904 idx ++;
2905 }
2906 DAS_ASSERT(0 && "we should not even be here. field index out of range somehow???");
2907 return -1;
2908 }
2909
2910 int TypeDecl::getTupleSize() const {
2911 uint64_t size = getTupleSize64();

Callers 5

setRefSpMethod · 0.80
simulateExprMakeTupleMethod · 0.80
sv_trySimulate_FieldMethod · 0.80
visitMethod · 0.80
get_tuple_field_offsetFunction · 0.80

Calls 3

sizeMethod · 0.45
getAlignOfMethod · 0.45
getSizeOfMethod · 0.45

Tested by

no test coverage detected