Fun 0.41.5
The programming language that makes you have fun!
Loading...
Searching...
No Matches
abs.c File Reference

Implements the OP_ABS opcode for absolute value in the VM. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

 if (x.type !=VAL_INT)
 if (v< 0) v
 push_value (vm, make_int(v))
 free_value (x)

Variables

case OP_ABS
int64_t v = x.i
 break

Detailed Description

Implements the OP_ABS opcode for absolute value in the VM.

This file handles the OP_ABS instruction, which computes the absolute value of an integer.

Behavior:

  • Pops value from stack
  • Pushes |value|

Error Handling:

  • Exits if not integer

Definition in file abs.c.

Function Documentation

◆ free_value()

free_value ( x )

◆ if() [1/2]

if ( )

Definition at line 42 of file insert.c.

◆ if() [2/2]

if ( x.type ! = VAL_INT)

Definition at line 27 of file abs.c.

◆ push_value()

push_value ( vm ,
make_int(v)  )

Variable Documentation

◆ break

break

Definition at line 35 of file abs.c.

◆ OP_ABS

case OP_ABS

Definition at line 25 of file abs.c.

◆ v

int64_t v = x.i

Definition at line 31 of file abs.c.