1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2024-11-08 06:09:15 +00:00

Back to directly manipulating FOR index value

This commit is contained in:
David Schmenk 2024-07-20 07:19:07 -07:00
parent f9b7c51b3d
commit 4c4ec7c985

View File

@ -1242,21 +1242,18 @@ end
def natv_for(symptr, expr) def natv_for(symptr, expr)
var index, ufunc, dlist var index, ufunc, dlist
var[2] indexval, incval, stepval var[2] incval, stepval
index = expr=>car if expr=>car->type & TYPE_MASK <> SYM_TYPE
expr = expr=>cdr
if index->type & TYPE_MASK <> SYM_TYPE
puts("For index not symbol\n") puts("For index not symbol\n")
return NULL return NULL
fin fin
symptr = eval_expr(index) index = eval_expr(expr=>car)
if symptr->type <> NUM_INT expr = expr=>cdr
if index->type <> NUM_INT
puts("FOR index not integer\n") puts("FOR index not integer\n")
return NULL return NULL
fin fin
indexval[0] = symptr=>intval[0]
indexval[1] = symptr=>intval[1]
symptr = eval_expr(expr=>car) symptr = eval_expr(expr=>car)
expr = expr=>cdr expr = expr=>cdr
if symptr->type <> NUM_INT if symptr->type <> NUM_INT
@ -1288,10 +1285,9 @@ def natv_for(symptr, expr)
sweep_stack[sweep_stack_top - 1] = eval_expr(expr=>car) sweep_stack[sweep_stack_top - 1] = eval_expr(expr=>car)
expr = expr=>cdr expr = expr=>cdr
loop loop
load32(@indexval) load32(index + intval) // Manipulate integer value directly!
add32(@stepval) add32(@stepval)
store32(@indexval) store32(index + intval)
set_assoc(index, new_int(indexval[0], indexval[1]))
loop loop
return pop_sweep_stack return pop_sweep_stack
end end