Rizin
unix-like reverse engineering framework and cli tools
rz_itv.h File Reference
#include <rz_types.h>

Go to the source code of this file.

Classes

struct  rz_interval_t
 

Typedefs

typedef struct rz_interval_t RzInterval
 
typedef RzInterval rz_itv_t
 

Functions

static RzIntervalrz_itv_new (ut64 addr, ut64 size)
 
static void rz_itv_free (RzInterval *itv)
 
static ut64 rz_itv_begin (RzInterval itv)
 
static ut64 rz_itv_size (RzInterval itv)
 
static ut64 rz_itv_end (RzInterval itv)
 
static bool rz_itv_eq (RzInterval itv, RzInterval itv2)
 
static bool rz_itv_contain (RzInterval itv, ut64 addr)
 
static bool rz_itv_include (RzInterval itv, RzInterval x)
 
static bool rz_itv_overlap (RzInterval itv, RzInterval x)
 
static bool rz_itv_overlap2 (RzInterval itv, ut64 addr, ut64 size)
 
static RzInterval rz_itv_intersect (RzInterval itv, RzInterval x)
 

Typedef Documentation

◆ rz_itv_t

Definition at line 19 of file rz_itv.h.

◆ RzInterval

typedef struct rz_interval_t RzInterval

Function Documentation

◆ rz_itv_begin()

◆ rz_itv_contain()

static bool rz_itv_contain ( RzInterval  itv,
ut64  addr 
)
inlinestatic

Definition at line 52 of file rz_itv.h.

52  {
53  const ut64 end = itv.addr + itv.size;
54  return itv.addr <= addr && (!end || addr < end);
55 }
ut64 size
Definition: rz_itv.h:16
ut64(WINAPI *w32_GetEnabledXStateFeatures)()
static int addr
Definition: z80asm.c:58

References addr, rz_interval_t::addr, test_evm::end, rz_interval_t::size, and ut64().

Referenced by rz_io_map_next_available(), and rz_table_visual_list().

◆ rz_itv_end()

◆ rz_itv_eq()

static bool rz_itv_eq ( RzInterval  itv,
RzInterval  itv2 
)
inlinestatic

Definition at line 47 of file rz_itv.h.

47  {
48  return itv.addr == itv2.addr && itv.size == itv2.size;
49 }

References rz_interval_t::addr, and rz_interval_t::size.

◆ rz_itv_free()

static void rz_itv_free ( RzInterval itv)
inlinestatic

Definition at line 30 of file rz_itv.h.

30  {
31  free(itv);
32 }
RZ_API void Ht_() free(HtName_(Ht) *ht)
Definition: ht_inc.c:130

References free().

◆ rz_itv_include()

static bool rz_itv_include ( RzInterval  itv,
RzInterval  x 
)
inlinestatic

Definition at line 58 of file rz_itv.h.

58  {
59  const ut64 end = itv.addr + itv.size;
60  return itv.addr <= x.addr && (!end || (x.addr + x.size && x.addr + x.size <= end));
61 }
int x
Definition: mipsasm.c:20

References rz_interval_t::addr, test_evm::end, rz_interval_t::size, ut64(), and x.

Referenced by rz_skyline_add().

◆ rz_itv_intersect()

static RzInterval rz_itv_intersect ( RzInterval  itv,
RzInterval  x 
)
inlinestatic

Definition at line 76 of file rz_itv.h.

76  {
77  const ut64 addr = RZ_MAX(itv.addr, x.addr);
78  const ut64 end = RZ_MIN(itv.addr + itv.size - 1, x.addr + x.size - 1) + 1;
79  RzInterval rai = { addr, end - addr };
80  return rai;
81 }
#define RZ_MIN(x, y)
#define RZ_MAX(x, y)

References addr, rz_interval_t::addr, test_evm::end, RZ_MAX, RZ_MIN, rz_interval_t::size, ut64(), and x.

Referenced by append_bound(), do_string_search(), rz_cmd_search(), and rz_core_search_rop().

◆ rz_itv_new()

static RzInterval* rz_itv_new ( ut64  addr,
ut64  size 
)
inlinestatic

Definition at line 21 of file rz_itv.h.

21  {
23  if (itv) {
24  itv->addr = addr;
25  itv->size = size;
26  }
27  return itv;
28 }
voidpf void uLong size
Definition: ioapi.h:138
#define RZ_NEW(x)
Definition: rz_types.h:285

References addr, rz_interval_t::addr, RZ_NEW, and rz_interval_t::size.

◆ rz_itv_overlap()

static bool rz_itv_overlap ( RzInterval  itv,
RzInterval  x 
)
inlinestatic

Definition at line 64 of file rz_itv.h.

64  {
65  const ut64 end = itv.addr + itv.size, end1 = x.addr + x.size;
66  return (!end1 || itv.addr < end1) && (!end || x.addr < end);
67 }

References rz_interval_t::addr, test_evm::end, rz_interval_t::size, ut64(), and x.

Referenced by append_bound(), do_asm_search(), do_string_search(), rz_cmd_search(), rz_core_search_rop(), rz_io_cache_commit(), rz_io_cache_invalidate(), rz_itv_overlap2(), and rz_skyline_add().

◆ rz_itv_overlap2()

static bool rz_itv_overlap2 ( RzInterval  itv,
ut64  addr,
ut64  size 
)
inlinestatic

Definition at line 69 of file rz_itv.h.

69  {
70  RzInterval rai = { addr, size };
71  return rz_itv_overlap(itv, rai);
72 }
static bool rz_itv_overlap(RzInterval itv, RzInterval x)
Definition: rz_itv.h:64

References addr, and rz_itv_overlap().

◆ rz_itv_size()