![]() | Fun 0.41.5 The programming language that makes You have fun |
Implements the OP_POW opcode for exponentiation in the VM. More...
Go to the source code of this file.
Functions | |
| if (a.type !=VAL_INT||b.type !=VAL_INT) | |
| if (exp< 0) | |
| free_value (a) | |
| free_value (b) | |
Variables | |
| case | OP_POW |
| Value | a = pop_value(vm) |
| int64_t | base = a.i |
| int64_t | exp = b.i |
| int64_t | res = 1 |
| else | |
| break | |
Implements the OP_POW opcode for exponentiation in the VM.
This file handles the OP_POW instruction, which computes the power of two integer values. The values are popped from the stack, and the result is pushed back.
Behavior:
Error Handling:
Example: // Bytecode: OP_POW // Stack before: [2, 3] // Stack after: [8]
Definition in file pow.c.
| free_value | ( | a | ) |
| free_value | ( | b | ) |
| else |