Fun 0.41.5
The programming language that makes You have fun
Loading...
Searching...
No Matches
bxor.c File Reference

Implements the OP_BXOR opcode bitwise XOR (uint32). More...

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

Go to the source code of this file.

Functions

 free_value (vb)
 free_value (va)
 push_value (vm, make_int((int64_t)(uint64_t) r))

Variables

case OP_BXOR
Value va = pop_value(vm)
uint32_t a = (va.type == VAL_INT) ? (uint32_t)va.i : 0u
uint32_t b = (vb.type == VAL_INT) ? (uint32_t)vb.i : 0u
uint32_t r = a ^ b
 break

Detailed Description

Implements the OP_BXOR opcode bitwise XOR (uint32).

This file is an opcode snippet included by vm.c. It implements a 32-bit unsigned bitwise XOR of two integer operands from the VM stack.

Stack effects:

  • pops: b, a
  • pushes: (uint32_t)(a ^ b)

Notes:

  • Operands are taken as 32-bit unsigned integers when of type VAL_INT; non-integer values are treated as 0.
  • Result is pushed back as VAL_INT, preserving 32-bit value in the low bits of the 64-bit integer storage.

Definition in file bxor.c.

Function Documentation

◆ free_value() [1/2]

free_value(va)

◆ free_value() [2/2]

free_value(vb)

◆ push_value()

push_value(vm,
make_int((int64_t)(uint64_t) r) )

Variable Documentation

◆ a

uint32_t a = (va.type == VAL_INT) ? (uint32_t)va.i : 0u

Definition at line 31 of file bxor.c.

◆ b

uint32_t b = (vb.type == VAL_INT) ? (uint32_t)vb.i : 0u

Definition at line 32 of file bxor.c.

◆ break

break

Definition at line 37 of file bxor.c.

◆ OP_BXOR

case OP_BXOR

Definition at line 28 of file bxor.c.

◆ r

uint32_t r = a ^ b

Definition at line 33 of file bxor.c.

◆ va

Value va = pop_value(vm)

Definition at line 30 of file bxor.c.