uxn

Varvara Ordinator, written in ANSI C(SDL2)
git clone https://git.eamoncaddigan.net/uxn.git
Log | Files | Refs | README | LICENSE

commit 44157aae5bb3c4bb2592ca7d07fe16ac6f7502d2
parent 296d4c5070f0c2a81739800743bf269205999ce3
Author: Andrew Alderwick <andrew@alderwick.co.uk>
Date:   Sun, 28 Mar 2021 20:37:37 +0100

Removed redundant modulo operations.

Diffstat:
Msrc/uxn.c | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/uxn.c b/src/uxn.c @@ -64,7 +64,7 @@ void op_div(Uxn *u) { Uint8 a = pop8(u->src), b = pop8(u->src); push8(u->src, b void op_and(Uxn *u) { Uint8 a = pop8(u->src), b = pop8(u->src); push8(u->src, b & a); } void op_ora(Uxn *u) { Uint8 a = pop8(u->src), b = pop8(u->src); push8(u->src, b | a); } void op_eor(Uxn *u) { Uint8 a = pop8(u->src), b = pop8(u->src); push8(u->src, b ^ a); } -void op_sft(Uxn *u) { Uint8 a = pop8(u->src), b = pop8(u->src); push8(u->src, b >> ((a & 0x0f) % 8) << (((a & 0xf0) >> 4) % 8)); } +void op_sft(Uxn *u) { Uint8 a = pop8(u->src), b = pop8(u->src); push8(u->src, b >> (a & 0x07) << ((a & 0x70) >> 4)); } /* Stack */ void op_lit16(Uxn *u) { u->literal += 2; } void op_nop16(Uxn *u) { printf("%04x\n", pop16(u->src)); } @@ -97,7 +97,7 @@ void op_div16(Uxn *u) { Uint16 a = pop16(u->src), b = pop16(u->src); push16(u->s void op_and16(Uxn *u) { Uint16 a = pop16(u->src), b = pop16(u->src); push16(u->src, b & a); } void op_ora16(Uxn *u) { Uint16 a = pop16(u->src), b = pop16(u->src); push16(u->src, b | a); } void op_eor16(Uxn *u) { Uint16 a = pop16(u->src), b = pop16(u->src); push16(u->src, b ^ a); } -void op_sft16(Uxn *u) { Uint16 a = pop16(u->src), b = pop16(u->src); push16(u->src, b >> ((a & 0x000f) % 16) << (((a & 0x00f0) >> 4) % 16)); } +void op_sft16(Uxn *u) { Uint16 a = pop16(u->src), b = pop16(u->src); push16(u->src, b >> (a & 0x000f) << ((a & 0x00f0) >> 4)); } void (*ops[])(Uxn *u) = { op_brk, op_nop, op_lit, op_pop, op_dup, op_swp, op_ovr, op_rot,