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

Go to the source code of this file.

Functions

RZ_API RzILBoolrz_il_bool_new (bool true_or_false)
 
RZ_API RzILBoolrz_il_bool_and (RZ_NONNULL RzILBool *a, RZ_NONNULL RzILBool *b)
 
RZ_API RzILBoolrz_il_bool_or (RZ_NONNULL RzILBool *a, RZ_NONNULL RzILBool *b)
 
RZ_API RzILBoolrz_il_bool_xor (RZ_NONNULL RzILBool *a, RZ_NONNULL RzILBool *b)
 
RZ_API RzILBoolrz_il_bool_not (RZ_NONNULL RzILBool *a)
 
RZ_API void rz_il_bool_free (RzILBool *bool_var)
 

Function Documentation

◆ rz_il_bool_and()

RZ_API RzILBool* rz_il_bool_and ( RZ_NONNULL RzILBool a,
RZ_NONNULL RzILBool b 
)

result of a AND b

Parameters
aRzILBool, operand of AND
bRzILBool, operand of AND
Returns
bool RzILBool, pointer to the result

Definition at line 26 of file bool.c.

26  {
28  bool result = a->b && b->b;
29  RzILBool *ret = rz_il_bool_new(result);
30  return ret;
31 }
RZ_API RzILBool * rz_il_bool_new(bool true_or_false)
Definition: bool.c:11
#define NULL
Definition: cris-opc.c:27
#define rz_return_val_if_fail(expr, val)
Definition: rz_assert.h:108
#define b(i)
Definition: sha256.c:42
#define a(i)
Definition: sha256.c:41

References a, b, NULL, rz_il_bool_new(), and rz_return_val_if_fail.

Referenced by rz_il_handler_bool_and().

◆ rz_il_bool_free()

RZ_API void rz_il_bool_free ( RzILBool bool_var)

Free RzILBool instance

Parameters
bool_varRzILBool, pointer to the bool instance

Definition at line 74 of file bool.c.

74  {
75  if (!bool_var) {
76  return;
77  }
78  free(bool_var);
79 }
RZ_API void Ht_() free(HtName_(Ht) *ht)
Definition: ht_inc.c:130

References free().

Referenced by rz_il_handler_bool_and(), rz_il_handler_bool_inv(), rz_il_handler_bool_or(), rz_il_handler_bool_xor(), rz_il_handler_branch(), rz_il_handler_cast(), rz_il_handler_ite(), rz_il_handler_repeat(), rz_il_handler_shiftl(), rz_il_handler_shiftr(), and rz_il_value_free().

◆ rz_il_bool_new()

RZ_API RzILBool* rz_il_bool_new ( bool  true_or_false)

Create a new RzILBool instance

Parameters
true_or_falsebool, set bool as true or false
Returns
bool RzILBool, pointer to bool value

Definition at line 11 of file bool.c.

11  {
12  RzILBool *ret = RZ_NEW0(RzILBool);
13  if (!ret) {
14  return NULL;
15  }
16  ret->b = true_or_false;
17  return ret;
18 }
#define RZ_NEW0(x)
Definition: rz_types.h:284
bool b
Definition: bool.h:15

References rz_il_bool_t::b, NULL, and RZ_NEW0.

Referenced by rz_core_analysis_il_vm_set(), rz_il_bool_and(), rz_il_bool_not(), rz_il_bool_or(), rz_il_bool_xor(), rz_il_handler_bool_false(), rz_il_handler_bool_true(), rz_il_handler_eq(), rz_il_handler_is_zero(), rz_il_handler_lsb(), rz_il_handler_msb(), rz_il_handler_sle(), rz_il_handler_ule(), rz_il_handler_var(), rz_il_value_dup(), rz_il_value_new_zero_of(), and rz_il_vm_sync_from_reg().

◆ rz_il_bool_not()

RZ_API RzILBool* rz_il_bool_not ( RZ_NONNULL RzILBool a)

result of NOT a

Parameters
aRzILBool, operand of AND
Returns
bool RzILBool, pointer to the result

Definition at line 63 of file bool.c.

63  {
65  bool result = !a->b;
66  RzILBool *ret = rz_il_bool_new(result);
67  return ret;
68 }

References a, NULL, rz_il_bool_new(), and rz_return_val_if_fail.

Referenced by rz_il_handler_bool_inv().

◆ rz_il_bool_or()

RZ_API RzILBool* rz_il_bool_or ( RZ_NONNULL RzILBool a,
RZ_NONNULL RzILBool b 
)

result of a OR b

Parameters
aRzILBool, operand of AND
bRzILBool, operand of AND
Returns
bool RzILBool, pointer to the result

Definition at line 39 of file bool.c.

39  {
41  bool result = a->b || b->b;
42  RzILBool *ret = rz_il_bool_new(result);
43  return ret;
44 }

References a, b, NULL, rz_il_bool_new(), and rz_return_val_if_fail.

Referenced by rz_il_handler_bool_or().

◆ rz_il_bool_xor()

RZ_API RzILBool* rz_il_bool_xor ( RZ_NONNULL RzILBool a,
RZ_NONNULL RzILBool b 
)

result of a XOR b

Parameters
aRzILBool, operand of AND
bRzILBool, operand of AND
Returns
bool RzILBool, pointer to the result

Definition at line 52 of file bool.c.

52  {
54  bool result = a->b != b->b;
55  return rz_il_bool_new(result);
56 }

References a, b, NULL, rz_il_bool_new(), and rz_return_val_if_fail.

Referenced by rz_il_handler_bool_xor().