Rizin
unix-like reverse engineering framework and cli tools
theory_bool.c File Reference

Go to the source code of this file.

Functions

void * rz_il_handler_bool_false (RzILVM *vm, RzILOpBool *op, RzILTypePure *type)
 also known as b0 More...
 
void * rz_il_handler_bool_true (RzILVM *vm, RzILOpBool *op, RzILTypePure *type)
 also known as b1 More...
 
void * rz_il_handler_bool_and (RzILVM *vm, RzILOpBool *op, RzILTypePure *type)
 
void * rz_il_handler_bool_or (RzILVM *vm, RzILOpBool *op, RzILTypePure *type)
 
void * rz_il_handler_bool_xor (RzILVM *vm, RzILOpBool *op, RzILTypePure *type)
 
void * rz_il_handler_bool_inv (RzILVM *vm, RzILOpBool *op, RzILTypePure *type)
 also known as boolean not More...
 

Function Documentation

◆ rz_il_handler_bool_and()

void* rz_il_handler_bool_and ( RzILVM vm,
RzILOpBool op,
RzILTypePure type 
)

Definition at line 29 of file theory_bool.c.

29  {
30  rz_return_val_if_fail(vm && op && type, NULL);
31 
32  RzILOpArgsBoolAnd *op_and = &op->op.booland;
33  RzILBool *x = rz_il_evaluate_bool(vm, op_and->x);
34  RzILBool *y = rz_il_evaluate_bool(vm, op_and->y);
35 
36  RzILBool *result = x && y ? rz_il_bool_and(x, y) : NULL;
38  rz_il_bool_free(y);
39 
41  return result;
42 }
RZ_API RzILBool * rz_il_bool_and(RZ_NONNULL RzILBool *a, RZ_NONNULL RzILBool *b)
Definition: bool.c:26
RZ_API void rz_il_bool_free(RzILBool *bool_var)
Definition: bool.c:74
#define NULL
Definition: cris-opc.c:27
RZ_API RZ_NULLABLE RZ_OWN RzILBool * rz_il_evaluate_bool(RZ_NONNULL RzILVM *vm, RZ_NONNULL RzILOpBool *op)
Definition: il_vm_eval.c:289
int x
Definition: mipsasm.c:20
int type
Definition: mipsasm.c:17
#define rz_return_val_if_fail(expr, val)
Definition: rz_assert.h:108
@ RZ_IL_TYPE_PURE_BOOL
Definition: sort.h:24
op structure for and, or and xor (bool -> bool -> bool)
RzILOpBool * x
left operand
RzILOpBool * y
right operand
Definition: dis.c:32

References NULL, rz_il_bool_and(), rz_il_bool_free(), rz_il_evaluate_bool(), RZ_IL_TYPE_PURE_BOOL, rz_return_val_if_fail, type, x, rz_il_op_args_bool_operation_t::x, and rz_il_op_args_bool_operation_t::y.

◆ rz_il_handler_bool_false()

void* rz_il_handler_bool_false ( RzILVM vm,
RzILOpBool op,
RzILTypePure type 
)

also known as b0

Definition at line 10 of file theory_bool.c.

10  {
11  rz_return_val_if_fail(vm && op && type, NULL);
12 
13  RzILBool *ret = rz_il_bool_new(false);
15  return ret;
16 }
RZ_API RzILBool * rz_il_bool_new(bool true_or_false)
Definition: bool.c:11

References NULL, rz_il_bool_new(), RZ_IL_TYPE_PURE_BOOL, rz_return_val_if_fail, and type.

◆ rz_il_handler_bool_inv()

void* rz_il_handler_bool_inv ( RzILVM vm,
RzILOpBool op,
RzILTypePure type 
)

also known as boolean not

Definition at line 77 of file theory_bool.c.

77  {
78  rz_return_val_if_fail(vm && op && type, NULL);
79 
80  RzILOpArgsBoolInv *op_inv = &op->op.boolinv;
81  RzILBool *x = rz_il_evaluate_bool(vm, op_inv->x);
82  RzILBool *result = x ? rz_il_bool_not(x) : NULL;
84 
86  return result;
87 }
RZ_API RzILBool * rz_il_bool_not(RZ_NONNULL RzILBool *a)
Definition: bool.c:63
op structure for inv (!bool -> bool)
RzILOpBool * x
single operand

References NULL, rz_il_bool_free(), rz_il_bool_not(), rz_il_evaluate_bool(), RZ_IL_TYPE_PURE_BOOL, rz_return_val_if_fail, type, x, and rz_il_op_args_bool_inv_t::x.

◆ rz_il_handler_bool_or()

void* rz_il_handler_bool_or ( RzILVM vm,
RzILOpBool op,
RzILTypePure type 
)

Definition at line 44 of file theory_bool.c.

44  {
45  rz_return_val_if_fail(vm && op && type, NULL);
46 
47  RzILOpArgsBoolOr *op_or = &op->op.boolor;
48  RzILBool *x = rz_il_evaluate_bool(vm, op_or->x);
49  RzILBool *y = rz_il_evaluate_bool(vm, op_or->y);
50 
51  RzILBool *result = x && y ? rz_il_bool_or(x, y) : NULL;
53  rz_il_bool_free(y);
54 
56  return result;
57 }
RZ_API RzILBool * rz_il_bool_or(RZ_NONNULL RzILBool *a, RZ_NONNULL RzILBool *b)
Definition: bool.c:39

References NULL, rz_il_bool_free(), rz_il_bool_or(), rz_il_evaluate_bool(), RZ_IL_TYPE_PURE_BOOL, rz_return_val_if_fail, type, x, rz_il_op_args_bool_operation_t::x, and rz_il_op_args_bool_operation_t::y.

◆ rz_il_handler_bool_true()

void* rz_il_handler_bool_true ( RzILVM vm,
RzILOpBool op,
RzILTypePure type 
)

also known as b1

Definition at line 21 of file theory_bool.c.

21  {
22  rz_return_val_if_fail(vm && op && type, NULL);
23 
24  RzILBool *ret = rz_il_bool_new(true);
26  return ret;
27 }

References NULL, rz_il_bool_new(), RZ_IL_TYPE_PURE_BOOL, rz_return_val_if_fail, and type.

◆ rz_il_handler_bool_xor()

void* rz_il_handler_bool_xor ( RzILVM vm,
RzILOpBool op,
RzILTypePure type 
)

Definition at line 59 of file theory_bool.c.

59  {
60  rz_return_val_if_fail(vm && op && type, NULL);
61 
62  RzILOpArgsBoolXor *op_xor = &op->op.boolxor;
63  RzILBool *x = rz_il_evaluate_bool(vm, op_xor->x);
64  RzILBool *y = rz_il_evaluate_bool(vm, op_xor->y);
65 
66  RzILBool *result = x && y ? rz_il_bool_xor(x, y) : NULL;
68  rz_il_bool_free(y);
69 
71  return result;
72 }
RZ_API RzILBool * rz_il_bool_xor(RZ_NONNULL RzILBool *a, RZ_NONNULL RzILBool *b)
Definition: bool.c:52

References NULL, rz_il_bool_free(), rz_il_bool_xor(), rz_il_evaluate_bool(), RZ_IL_TYPE_PURE_BOOL, rz_return_val_if_fail, type, x, rz_il_op_args_bool_operation_t::x, and rz_il_op_args_bool_operation_t::y.