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

Go to the source code of this file.

Macros

#define DIFF_IS_BYTES_METHOD(x)   (x.elem_at == methods_bytes.elem_at)
 

Functions

static const void * byte_elem_at (const ut8 *array, ut32 index)
 
static int byte_compare (const ut8 *a_elem, const ut8 *b_elem)
 
static ut32 byte_hash (const char *elem)
 
static void byte_stringify (const ut8 *a_elem, RzStrBuf *sb)
 

Variables

static const MethodsInternal methods_bytes
 

Macro Definition Documentation

◆ DIFF_IS_BYTES_METHOD

#define DIFF_IS_BYTES_METHOD (   x)    (x.elem_at == methods_bytes.elem_at)

Definition at line 6 of file bytes_diff.c.

Function Documentation

◆ byte_compare()

static int byte_compare ( const ut8 a_elem,
const ut8 b_elem 
)
static

Definition at line 12 of file bytes_diff.c.

12  {
13  return ((int)b_elem[0]) - ((int)a_elem[0]);
14 }
static int
Definition: sfsocketcall.h:114

References int.

◆ byte_elem_at()

static const void* byte_elem_at ( const ut8 array,
ut32  index 
)
static

Definition at line 8 of file bytes_diff.c.

8  {
9  return &array[index];
10 }

◆ byte_hash()

static ut32 byte_hash ( const char *  elem)
static

Definition at line 16 of file bytes_diff.c.

16  {
17  return elem[0];
18 }

◆ byte_stringify()

static void byte_stringify ( const ut8 a_elem,
RzStrBuf sb 
)
static

Definition at line 20 of file bytes_diff.c.

20  {
21  rz_strbuf_setf(sb, "%02x", *a_elem);
22 }
static SblHeader sb
Definition: bin_mbn.c:26
RZ_API const char * rz_strbuf_setf(RzStrBuf *sb, const char *fmt,...) RZ_PRINTF_CHECK(2

References rz_strbuf_setf(), and sb.

Variable Documentation

◆ methods_bytes

const MethodsInternal methods_bytes
static
Initial value:
= {
.ignore = fake_ignore,
.free = NULL,
}
static ut32 byte_hash(const char *elem)
Definition: bytes_diff.c:16
static const void * byte_elem_at(const ut8 *array, ut32 index)
Definition: bytes_diff.c:8
static void byte_stringify(const ut8 *a_elem, RzStrBuf *sb)
Definition: bytes_diff.c:20
static int byte_compare(const ut8 *a_elem, const ut8 *b_elem)
Definition: bytes_diff.c:12
#define NULL
Definition: cris-opc.c:27
static bool fake_ignore(const void *value)
Definition: diff.c:118
const void *(* RzDiffMethodElemAt)(RZ_BORROW const void *array, ut32 index)
Definition: rz_diff.h:36
ut32(* RzDiffMethodElemHash)(RZ_BORROW const void *elem)
Definition: rz_diff.h:37
void(* RzDiffMethodStringify)(RZ_BORROW const void *elem, RZ_BORROW RzStrBuf *sb)
Definition: rz_diff.h:40
int(* RzDiffMethodCompare)(RZ_BORROW const void *a_elem, RZ_BORROW const void *b_elem)
Definition: rz_diff.h:38

Definition at line 24 of file bytes_diff.c.

Referenced by rz_diff_bytes_new().