From 21ff0751dcdb63c3eba27695474c46c7168ad17f Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Mon, 6 Jul 2026 17:42:01 +0800 Subject: [PATCH] fix error name --- include/pocketpy/pocketpy.h | 6 +++--- src/bindings/py_number.c | 24 ++++++++++++------------ src/modules/array2d.c | 6 +++--- src/modules/vmath.c | 8 ++++---- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/include/pocketpy/pocketpy.h b/include/pocketpy/pocketpy.h index 1a55f5b9..a2620638 100644 --- a/include/pocketpy/pocketpy.h +++ b/include/pocketpy/pocketpy.h @@ -800,9 +800,9 @@ PK_API char* py_profiler_report(); /************* Others *************/ int64_t time_ns(); int64_t time_monotonic_ns(); -py_i64 cpy11__int_floordiv(py_i64 a, py_i64 b); -py_i64 cpy11__int_mod(py_i64 a, py_i64 b); -void cpy11__float_divmod(double vx, double wx, double *floordiv, double *mod); +py_i64 cpy312__int_floordiv(py_i64 a, py_i64 b); +py_i64 cpy312__int_mod(py_i64 a, py_i64 b); +void cpy312__float_divmod(double vx, double wx, double *floordiv, double *mod); /// An utility function to read a line from stdin for REPL. PK_API int py_replinput(char* buf, int max_size); diff --git a/src/bindings/py_number.c b/src/bindings/py_number.c index 5dc37ab3..7aeb49b6 100644 --- a/src/bindings/py_number.c +++ b/src/bindings/py_number.c @@ -127,7 +127,7 @@ static bool number__pow__(int argc, py_Ref argv) { static py_i64 i64_abs(py_i64 x) { return x < 0 ? -x : x; } -py_i64 cpy11__int_floordiv(py_i64 a, py_i64 b) { +py_i64 cpy312__int_floordiv(py_i64 a, py_i64 b) { assert(b != 0); if(a == 0) return 0; if((a < 0) == (b < 0)) { @@ -137,7 +137,7 @@ py_i64 cpy11__int_floordiv(py_i64 a, py_i64 b) { } } -py_i64 cpy11__int_mod(py_i64 a, py_i64 b) { +py_i64 cpy312__int_mod(py_i64 a, py_i64 b) { assert(b != 0); if(a == 0) return 0; py_i64 res; @@ -150,7 +150,7 @@ py_i64 cpy11__int_mod(py_i64 a, py_i64 b) { } // https://github.com/python/cpython/blob/3.11/Objects/floatobject.c#L677 -void cpy11__float_divmod(double vx, double wx, double *floordiv, double *mod) +void cpy312__float_divmod(double vx, double wx, double *floordiv, double *mod) { double div; *mod = dmath_fmod(vx, wx); @@ -193,7 +193,7 @@ static bool int__floordiv__(int argc, py_Ref argv) { if(py_isint(&argv[1])) { py_i64 rhs = py_toint(&argv[1]); if(rhs == 0) return ZeroDivisionError("integer division by zero"); - py_newint(py_retval(), cpy11__int_floordiv(lhs, rhs)); + py_newint(py_retval(), cpy312__int_floordiv(lhs, rhs)); } else { py_newnotimplemented(py_retval()); } @@ -206,7 +206,7 @@ static bool int__mod__(int argc, py_Ref argv) { if(py_isint(&argv[1])) { py_i64 rhs = py_toint(&argv[1]); if(rhs == 0) return ZeroDivisionError("integer modulo by zero"); - py_newint(py_retval(), cpy11__int_mod(lhs, rhs)); + py_newint(py_retval(), cpy312__int_mod(lhs, rhs)); } else { py_newnotimplemented(py_retval()); } @@ -220,7 +220,7 @@ static bool float__floordiv__(int argc, py_Ref argv) { if(try_castfloat(&argv[1], &rhs)) { if(rhs == 0.0) return ZeroDivisionError("float modulo by zero"); double q, r; - cpy11__float_divmod(lhs, rhs, &q, &r); + cpy312__float_divmod(lhs, rhs, &q, &r); py_newfloat(py_retval(), q); return true; } @@ -235,7 +235,7 @@ static bool float__rfloordiv__(int argc, py_Ref argv) { if(try_castfloat(&argv[1], &lhs)) { if(rhs == 0.0) return ZeroDivisionError("float modulo by zero"); double q, r; - cpy11__float_divmod(lhs, rhs, &q, &r); + cpy312__float_divmod(lhs, rhs, &q, &r); py_newfloat(py_retval(), q); return true; } @@ -250,7 +250,7 @@ static bool float__mod__(int argc, py_Ref argv) { if(try_castfloat(&argv[1], &rhs)) { if(rhs == 0.0) return ZeroDivisionError("float modulo by zero"); double q, r; - cpy11__float_divmod(lhs, rhs, &q, &r); + cpy312__float_divmod(lhs, rhs, &q, &r); py_newfloat(py_retval(), r); return true; } @@ -265,7 +265,7 @@ static bool float__rmod__(int argc, py_Ref argv) { if(try_castfloat(&argv[1], &lhs)) { if(rhs == 0.0) return ZeroDivisionError("float modulo by zero"); double q, r; - cpy11__float_divmod(lhs, rhs, &q, &r); + cpy312__float_divmod(lhs, rhs, &q, &r); py_newfloat(py_retval(), r); return true; } @@ -280,7 +280,7 @@ static bool float__divmod__(int argc, py_Ref argv) { if(try_castfloat(&argv[1], &rhs)) { if(rhs == 0.0) return ZeroDivisionError("float modulo by zero"); double q, r; - cpy11__float_divmod(lhs, rhs, &q, &r); + cpy312__float_divmod(lhs, rhs, &q, &r); py_Ref p = py_newtuple(py_retval(), 2); py_newfloat(&p[0], q); py_newfloat(&p[1], r); @@ -296,8 +296,8 @@ static bool int__divmod__(int argc, py_Ref argv) { py_i64 rhs = py_toint(&argv[1]); if(rhs == 0) return ZeroDivisionError("integer division or modulo by zero"); py_Ref p = py_newtuple(py_retval(), 2); - py_newint(&p[0], cpy11__int_floordiv(lhs, rhs)); - py_newint(&p[1], cpy11__int_mod(lhs, rhs)); + py_newint(&p[0], cpy312__int_floordiv(lhs, rhs)); + py_newint(&p[1], cpy312__int_mod(lhs, rhs)); return true; } diff --git a/src/modules/array2d.c b/src/modules/array2d.c index 9387b7ec..31adce8c 100644 --- a/src/modules/array2d.c +++ b/src/modules/array2d.c @@ -1023,7 +1023,7 @@ static py_TValue* c11_chunked_array2d__new_chunk(c11_chunked_array2d* self, c11_ } static void - cpy11__divmod_int_uint(int a, int b_log2, int b_mask, int* restrict q, int* restrict r) { + cpy312__divmod_int_uint(int a, int b_log2, int b_mask, int* restrict q, int* restrict r) { if(a >= 0) { *q = a >> b_log2; *r = a & b_mask; @@ -1038,12 +1038,12 @@ static void c11_chunked_array2d__world_to_chunk(c11_chunked_array2d* self, int row, c11_vec2i* restrict chunk_pos, c11_vec2i* restrict local_pos) { - cpy11__divmod_int_uint(col, + cpy312__divmod_int_uint(col, self->chunk_size_log2, self->chunk_size_mask, &chunk_pos->x, &local_pos->x); - cpy11__divmod_int_uint(row, + cpy312__divmod_int_uint(row, self->chunk_size_log2, self->chunk_size_mask, &chunk_pos->y, diff --git a/src/modules/vmath.c b/src/modules/vmath.c index 4784b910..86ba8e8d 100644 --- a/src/modules/vmath.c +++ b/src/modules/vmath.c @@ -8,8 +8,8 @@ static bool isclose(float a, float b) { return dmath_fabs(a - b) < 1e-4; } -py_i64 cpy11__int_floordiv(py_i64 a, py_i64 b); -py_i64 cpy11__int_mod(py_i64 a, py_i64 b); +py_i64 cpy312__int_floordiv(py_i64 a, py_i64 b); +py_i64 cpy312__int_mod(py_i64 a, py_i64 b); #define DEFINE_VEC_FIELD(name, T, Tc, field) \ static bool name##__##field(int argc, py_Ref argv) { \ @@ -317,7 +317,7 @@ DEF_VECTOR_OPS(3) c11_vec##D##i a = py_tovec##D##i(&argv[0]); \ py_i64 b = py_toint(&argv[1]); \ for(int i = 0; i < D; i++) \ - a.data[i] = cpy11__int_floordiv(a.data[i], b); \ + a.data[i] = cpy312__int_floordiv(a.data[i], b); \ py_newvec##D##i(py_retval(), a); \ return true; \ } \ @@ -327,7 +327,7 @@ DEF_VECTOR_OPS(3) c11_vec##D##i a = py_tovec##D##i(&argv[0]); \ py_i64 b = py_toint(&argv[1]); \ for(int i = 0; i < D; i++) \ - a.data[i] = cpy11__int_mod(a.data[i], b); \ + a.data[i] = cpy312__int_mod(a.data[i], b); \ py_newvec##D##i(py_retval(), a); \ return true; \ }