Added count field type argument to the list attribute

This commit is contained in:
Samuele Lorefice
2025-03-06 19:41:37 +01:00
parent e11cd54096
commit bfa185c8e4
12 changed files with 59 additions and 28 deletions

View File

@@ -26,5 +26,22 @@ namespace CodeGenerator {
_ => str
};
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int ParseFSize(this string str) {
return str switch {
"char" => sizeof(char),
"short" => sizeof(short),
"int" => sizeof(int),
"float" => sizeof(float),
"double" => sizeof(double),
"ushort" => sizeof(ushort),
"uchar" => sizeof(byte),
"int64_t" => sizeof(long),
"int8_t" => sizeof(sbyte),
"uint64_t" => sizeof(ulong),
_ => throw new("Unknown type")
};
}
}
}