From 7916bb035fcff0c2beab062e15c313538f08cb11 Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Sat, 28 Oct 2023 11:08:27 +0800 Subject: [PATCH] some cleanup --- include/pocketpy/common.h | 12 ++++++------ include/pocketpy/lexer.h | 14 +++++++------- include/typings/linalg.pyi | 4 ++++ 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/include/pocketpy/common.h b/include/pocketpy/common.h index 555aabba..45afac97 100644 --- a/include/pocketpy/common.h +++ b/include/pocketpy/common.h @@ -119,12 +119,12 @@ union BitsCvtImpl<4>{ BitsCvtImpl(NumberTraits<4>::float_t val): _float(val) {} BitsCvtImpl(NumberTraits<4>::int_t val): _int(val) {} - void print(){ - std::string s = std::bitset<32>(_int).to_string(); - std::cout << s.substr(0, 1) << '|'; - std::cout << s.substr(1, 8) << '|'; - std::cout << s.substr(9) << std::endl; - } + // void print(){ + // std::string s = std::bitset<32>(_int).to_string(); + // std::cout << s.substr(0, 1) << '|'; + // std::cout << s.substr(1, 8) << '|'; + // std::cout << s.substr(9) << std::endl; + // } }; template<> diff --git a/include/pocketpy/lexer.h b/include/pocketpy/lexer.h index 75ce1980..56d5c834 100644 --- a/include/pocketpy/lexer.h +++ b/include/pocketpy/lexer.h @@ -59,13 +59,13 @@ struct Token{ Str str() const { return Str(start, length);} std::string_view sv() const { return std::string_view(start, length);} - Str info() const { - SStream ss; - ss << line << ": " << TK_STR(type) << " '" << ( - sv()=="\n" ? "\\n" : sv() - ) << "'"; - return ss.str(); - } + // Str info() const { + // SStream ss; + // ss << line << ": " << TK_STR(type) << " '" << ( + // sv()=="\n" ? "\\n" : sv() + // ) << "'"; + // return ss.str(); + // } }; // https://docs.python.org/3/reference/expressions.html#operator-precedence diff --git a/include/typings/linalg.pyi b/include/typings/linalg.pyi index 40bfc210..75610203 100644 --- a/include/typings/linalg.pyi +++ b/include/typings/linalg.pyi @@ -9,6 +9,7 @@ class vec2(_StructLike['vec2']): def __add__(self, other: vec2) -> vec2: ... def __sub__(self, other: vec2) -> vec2: ... def __mul__(self, other: float) -> vec2: ... + def __rmul__(self, other: float) -> vec2: ... def __truediv__(self, other: float) -> vec2: ... def dot(self, other: vec2) -> float: ... def cross(self, other: vec2) -> float: ... @@ -27,6 +28,7 @@ class vec3(_StructLike['vec3']): def __add__(self, other: vec3) -> vec3: ... def __sub__(self, other: vec3) -> vec3: ... def __mul__(self, other: float) -> vec3: ... + def __rmul__(self, other: float) -> vec3: ... def __truediv__(self, other: float) -> vec3: ... def dot(self, other: vec3) -> float: ... def cross(self, other: vec3) -> float: ... @@ -44,6 +46,7 @@ class vec4(_StructLike['vec4']): def __add__(self, other: vec4) -> vec4: ... def __sub__(self, other: vec4) -> vec4: ... def __mul__(self, other: float) -> vec4: ... + def __rmul__(self, other: float) -> vec4: ... def __truediv__(self, other: float) -> vec4: ... def dot(self, other: vec4) -> float: ... def length(self) -> float: ... @@ -80,6 +83,7 @@ class mat3x3(_StructLike['mat3x3']): def __add__(self, other: mat3x3) -> mat3x3: ... def __sub__(self, other: mat3x3) -> mat3x3: ... def __mul__(self, other: float) -> mat3x3: ... + def __rmul__(self, other: float) -> mat3x3: ... def __truediv__(self, other: float) -> mat3x3: ... def __invert__(self) -> mat3x3: ...