added support for variables and parameters as array. also improved conversion of variables and parameters into Expressionelement
Some checks are pending
CI / Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} (x64, ubuntu-latest, 1.10) (push) Waiting to run
CI / Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} (x64, ubuntu-latest, 1.6) (push) Waiting to run
CI / Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} (x64, ubuntu-latest, pre) (push) Waiting to run

This commit is contained in:
2025-05-09 11:04:10 +02:00
parent aaa3f2c7c0
commit 2c8a9cd2d8
7 changed files with 101 additions and 67 deletions

View File

@ -64,24 +64,20 @@ function interpret_expression(expressions::CuDeviceArray{ExpressionElement}, var
@inbounds firstVariableIndex = ((varSetIndex-1) * stepsize[3]) # Exclusive
@inbounds for i in firstExprIndex:lastExprIndex
expr = expressions[i]
if expr.Type == EMPTY
token = expressions[i]
if token.Type == EMPTY
break
elseif expr.Type == INDEX
val = expr.Value
elseif token.Type == VARIABLE
operationStackTop += 1
if val > 0
operationStack[operationStackTop] = variables[firstVariableIndex + val]
else
val = abs(val)
operationStack[operationStackTop] = parameters[firstParamIndex + val]
end
elseif expr.Type == FLOAT32
operationStack[operationStackTop] = variables[firstVariableIndex + token.Value]
elseif token.Type == PARAMETER
operationStackTop += 1
operationStack[operationStackTop] = reinterpret(Float32, expr.Value)
elseif expr.Type == OPERATOR
opcode = reinterpret(Operator, expr.Value)
operationStack[operationStackTop] = parameters[firstParamIndex + token.Value]
elseif token.Type == FLOAT32
operationStackTop += 1
operationStack[operationStackTop] = reinterpret(Float32, token.Value)
elseif token.Type == OPERATOR
opcode = reinterpret(Operator, token.Value)
if opcode == ADD
operationStackTop -= 1
operationStack[operationStackTop] = operationStack[operationStackTop] + operationStack[operationStackTop + 1]