public void InitializeOrganization() { this.totalParamSize = 0; this.totalResultSize = 0; // Pass 1. Get inverted offsets and get the total stack size for (int i = 0; i < this.paramTypes.Count; ++i) { DataOrgInfo doi = this.paramTypes[i]; FillInOrg(ref doi, ref this.totalParamSize); this.paramTypes[i] = doi; } for (int i = 0; i < this.resultTypes.Count; ++i) { DataOrgInfo doi = this.resultTypes[i]; FillInOrg(ref doi, ref this.totalResultSize); this.resultTypes[i] = doi; } foreach (DataOrgInfo doi in this.paramTypes) { this.paramByteOffsets.Add(this.totalParamSize - doi.alignmentCtr - doi.size); } foreach (DataOrgInfo doi in this.resultTypes) { this.resultByteOffsets.Add(this.totalResultSize - doi.alignmentCtr - doi.size); } }
public static void FillInOrg(ref DataOrgInfo doi, ref uint totalSize) { doi.alignmentCtr = totalSize; switch (doi.type) { case Bin.TypeID.Float32: doi.isFloat = true; doi.size = 4; break; case Bin.TypeID.Float64: doi.isFloat = true; doi.size = 8; break; case Bin.TypeID.Int32: doi.isFloat = false; doi.size = 4; break; case Bin.TypeID.Int64: doi.isFloat = false; doi.size = 8; break; } totalSize += doi.size; }