From 279fa1eccb68b04429d5b08f09de9d1839863043 Mon Sep 17 00:00:00 2001 From: yyc12345 Date: Sun, 26 Nov 2023 20:36:25 +0800 Subject: [PATCH] update code gen --- CodeGen/EnumsMigration/GeneralWriter.java | 4 ++-- CodeGen/VectorGen/VxVectors.py | 3 ++- LibCmo/VxMath/VxTypes.hpp | 9 ++++++--- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/CodeGen/EnumsMigration/GeneralWriter.java b/CodeGen/EnumsMigration/GeneralWriter.java index 2b2f6dd..d355076 100644 --- a/CodeGen/EnumsMigration/GeneralWriter.java +++ b/CodeGen/EnumsMigration/GeneralWriter.java @@ -171,7 +171,7 @@ public class GeneralWriter { // write implements for (EnumsHelper.Enum_t enum_t : prog.mEnums) { // write enum desc header - indent.printf("g_Annotation_%s: dict[int, AnnotationData] = {", enum_t.mEnumName); + indent.printf("g_Annotation_%s: dict[int, EnumAnnotation] = {", enum_t.mEnumName); indent.inc(); // write enum desc entries @@ -181,7 +181,7 @@ public class GeneralWriter { comment = CommonHelper.escapeString(enumEntry_t.mEntryComment); } - indent.printf("%s.%s.value: AnnotationData(\"%s\", \"%s\"),", enum_t.mEnumName, enumEntry_t.mEntryName, + indent.printf("%s.%s.value: EnumAnnotation(\"%s\", \"%s\"),", enum_t.mEnumName, enumEntry_t.mEntryName, extractHumanReadableEntryName(enumEntry_t.mEntryName), comment); } diff --git a/CodeGen/VectorGen/VxVectors.py b/CodeGen/VectorGen/VxVectors.py index 495fb00..cdf62df 100644 --- a/CodeGen/VectorGen/VxVectors.py +++ b/CodeGen/VectorGen/VxVectors.py @@ -35,7 +35,8 @@ def GetTmplOperOffset(sname: str, svars: tuple[str]) -> str: \t\t\t{sp.join(map(lambda x: f'case {x}: return {svars[x]};', range(len(svars))))} \t\t\tdefault: return {svars[0]}; \t\t}} -\t}}\tconst CKFLOAT& operator[](size_t i) const {{ +\t}} +\tconst CKFLOAT& operator[](size_t i) const {{ \t\tswitch (i) {{ \t\t\t{sp.join(map(lambda x: f'case {x}: return {svars[x]};', range(len(svars))))} \t\t\tdefault: return {svars[0]}; diff --git a/LibCmo/VxMath/VxTypes.hpp b/LibCmo/VxMath/VxTypes.hpp index 93c673b..b308718 100644 --- a/LibCmo/VxMath/VxTypes.hpp +++ b/LibCmo/VxMath/VxTypes.hpp @@ -36,7 +36,8 @@ namespace LibCmo::VxMath { case 1: return y; default: return x; } - } const CKFLOAT& operator[](size_t i) const { + } + const CKFLOAT& operator[](size_t i) const { switch (i) { case 0: return x; case 1: return y; @@ -120,7 +121,8 @@ namespace LibCmo::VxMath { case 2: return z; default: return x; } - } const CKFLOAT& operator[](size_t i) const { + } + const CKFLOAT& operator[](size_t i) const { switch (i) { case 0: return x; case 1: return y; @@ -211,7 +213,8 @@ namespace LibCmo::VxMath { case 3: return w; default: return x; } - } const CKFLOAT& operator[](size_t i) const { + } + const CKFLOAT& operator[](size_t i) const { switch (i) { case 0: return x; case 1: return y;