From dcae3d482444554e8d743d85a0fec43acbebf763 Mon Sep 17 00:00:00 2001 From: Arseny Kapoulkine Date: Mon, 27 Nov 2023 10:57:32 -0800 Subject: [PATCH] Add DIVRK test for vectors and also change variable names in VM for consistency --- VM/src/lvmexecute.cpp | 8 ++++---- tests/conformance/vector.lua | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/VM/src/lvmexecute.cpp b/VM/src/lvmexecute.cpp index 9af25af6..e270b816 100644 --- a/VM/src/lvmexecute.cpp +++ b/VM/src/lvmexecute.cpp @@ -1859,8 +1859,8 @@ reentry: else if (ttisvector(rb)) { const float* vb = rb->value.v; - float vc = cast_to(float, nvalue(kv)); - setvvalue(ra, vb[0] / vc, vb[1] / vc, vb[2] / vc, vb[3] / vc); + float nc = cast_to(float, nvalue(kv)); + setvvalue(ra, vb[0] / nc, vb[1] / nc, vb[2] / nc, vb[3] / nc); VM_NEXT(); } else @@ -2733,9 +2733,9 @@ reentry: } else if (ttisvector(rc)) { - float vb = cast_to(float, nvalue(kv)); + float nb = cast_to(float, nvalue(kv)); const float* vc = rc->value.v; - setvvalue(ra, vb / vc[0], vb / vc[1], vb / vc[2], vb / vc[3]); + setvvalue(ra, nb / vc[0], nb / vc[1], nb / vc[2], nb / vc[3]); VM_NEXT(); } else diff --git a/tests/conformance/vector.lua b/tests/conformance/vector.lua index c9cc47aa..04cd657e 100644 --- a/tests/conformance/vector.lua +++ b/tests/conformance/vector.lua @@ -64,6 +64,8 @@ end assert(vector(1, 2, 4) / 8 == vector(1/8, 1/4, 1/2)); assert(vector(1, 2, 4) / (1 / val) == vector(1/8, 2/8, 4/8)); assert(vector(1, 2, 4) / '8' == vector(1/8, 1/4, 1/2)); +assert(vector(1, 2, 4) / 8 == vector(1/8, 1/4, 1/2)); +assert(1 / vector(1, 2, 4) == vector(1, 1/2, 1/4)); assert(-vector(1, 2, 4) == vector(-1, -2, -4));