fix: correct argument order for store operations

Co-authored-by: aider (openrouter/deepseek/deepseek-v4-pro) <aider@aider.chat>
This commit is contained in:
2026-05-03 19:19:41 +03:00
parent 145035fb67
commit a0b535f0a3
+3 -3
View File
@@ -402,8 +402,8 @@ void do_fetch(Word* w) {
void do_store(Word* w) { void do_store(Word* w) {
(void)w; (void)w;
int64_t val = data_pop();
int64_t addr = data_pop(); int64_t addr = data_pop();
int64_t val = data_pop();
if (addr < 0 || addr >= user_mem_size) { if (addr < 0 || addr >= user_mem_size) {
printf("Address out of bounds\n"); printf("Address out of bounds\n");
return; return;
@@ -413,8 +413,8 @@ void do_store(Word* w) {
void do_plus_store(Word* w) { void do_plus_store(Word* w) {
(void)w; (void)w;
int64_t val = data_pop();
int64_t addr = data_pop(); int64_t addr = data_pop();
int64_t val = data_pop();
if (addr < 0 || addr >= user_mem_size) { if (addr < 0 || addr >= user_mem_size) {
printf("Address out of bounds\n"); printf("Address out of bounds\n");
return; return;
@@ -436,8 +436,8 @@ void do_cfetch(Word* w) {
void do_cstore(Word* w) { void do_cstore(Word* w) {
(void)w; (void)w;
int64_t val = data_pop();
int64_t addr = data_pop(); int64_t addr = data_pop();
int64_t val = data_pop();
int64_t max_byte = user_mem_size * (int64_t)sizeof(Cell); int64_t max_byte = user_mem_size * (int64_t)sizeof(Cell);
if (addr < 0 || addr >= max_byte) { if (addr < 0 || addr >= max_byte) {
printf("Address out of bounds\n"); printf("Address out of bounds\n");