Rizin
unix-like reverse engineering framework and cli tools
helpers.c
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2021 Anton Kochkov <anton.kochkov@gmail.com>
2 // SPDX-License-Identifier: LGPL-3.0-only
3 
4 #include <rz_util.h>
5 #include <rz_type.h>
6 #include <string.h>
7 
15 RZ_API RZ_OWN RzType *rz_type_identifier_of_base_type(const RzTypeDB *typedb, RZ_NONNULL const RzBaseType *btype, bool is_const) {
16  rz_return_val_if_fail(typedb && btype, NULL);
18  if (!type) {
19  return NULL;
20  }
22  type->identifier.name = strdup(btype->name);
23  type->identifier.is_const = is_const;
24  switch (btype->kind) {
26  type->identifier.kind = RZ_TYPE_IDENTIFIER_KIND_STRUCT;
27  break;
29  type->identifier.kind = RZ_TYPE_IDENTIFIER_KIND_UNION;
30  break;
32  type->identifier.kind = RZ_TYPE_IDENTIFIER_KIND_ENUM;
33  break;
34  default:
35  type->identifier.kind = RZ_TYPE_IDENTIFIER_KIND_UNSPECIFIED;
36  break;
37  }
38  return type;
39 }
40 
48  rz_return_val_if_fail(typedb && name, NULL);
49  RzBaseType *btype = rz_type_db_get_base_type(typedb, name);
50  if (!btype) {
51  return NULL;
52  }
53  return rz_type_identifier_of_base_type(typedb, btype, false);
54 }
55 
63 RZ_API RZ_OWN RzType *rz_type_pointer_of_base_type(const RzTypeDB *typedb, RZ_NONNULL const RzBaseType *btype, bool is_const) {
65  if (!type) {
66  return NULL;
67  }
68  RzType *t = rz_type_identifier_of_base_type(typedb, btype, false);
69  if (!t) {
71  return NULL;
72  }
73  type->kind = RZ_TYPE_KIND_POINTER;
74  type->pointer.type = t;
75  type->pointer.is_const = is_const;
76  return type;
77 }
78 
86 RZ_API RZ_OWN RzType *rz_type_pointer_of_base_type_str(const RzTypeDB *typedb, RZ_NONNULL const char *name, bool is_const) {
87  rz_return_val_if_fail(typedb && name, NULL);
88  RzBaseType *btype = rz_type_db_get_base_type(typedb, name);
89  if (!btype) {
90  return NULL;
91  }
92  return rz_type_pointer_of_base_type(typedb, btype, is_const);
93 }
94 
103  rz_return_val_if_fail(typedb && type, NULL);
104  if (type->kind == RZ_TYPE_KIND_IDENTIFIER) {
105  return rz_type_pointer_of_base_type_str(typedb, type->identifier.name, is_const);
106  }
107  RzType *newtype = RZ_NEW0(RzType);
108  if (!newtype) {
109  return NULL;
110  }
111  newtype->kind = RZ_TYPE_KIND_POINTER;
112  newtype->pointer.type = type;
113  newtype->pointer.is_const = is_const;
114  return newtype;
115 }
116 
126  if (!type) {
127  return NULL;
128  }
129  RzType *t = rz_type_identifier_of_base_type(typedb, btype, false);
130  if (!t) {
132  return NULL;
133  }
134  type->kind = RZ_TYPE_KIND_ARRAY;
135  type->array.type = t;
136  type->array.count = count;
137  return type;
138 }
139 
148  rz_return_val_if_fail(typedb && name && count, NULL);
149  RzBaseType *btype = rz_type_db_get_base_type(typedb, name);
150  if (!btype) {
151  return NULL;
152  }
153  return rz_type_array_of_base_type(typedb, btype, count);
154 }
155 
164  RzType *newtype = RZ_NEW0(RzType);
165  if (!newtype) {
166  return NULL;
167  }
168  newtype->kind = RZ_TYPE_KIND_ARRAY;
169  newtype->array.type = type;
170  newtype->array.count = count;
171  return newtype;
172 }
173 
174 // Equivalence checking
175 
183 RZ_API bool rz_type_atomic_eq(const RzTypeDB *typedb, RZ_NONNULL const RzType *typ1, RZ_NONNULL const RzType *typ2) {
184  // We aim to compare only atomic types, we can't compare more complex ones for now
185  rz_return_val_if_fail(typ1 && typ2, false);
187  rz_return_val_if_fail(typ1->identifier.kind == RZ_TYPE_IDENTIFIER_KIND_UNSPECIFIED, false);
188  rz_return_val_if_fail(typ2->identifier.kind == RZ_TYPE_IDENTIFIER_KIND_UNSPECIFIED, false);
189  rz_return_val_if_fail(typ1->identifier.name, false);
190  rz_return_val_if_fail(typ2->identifier.name, false);
191  RzBaseType *btyp1 = rz_type_db_get_base_type(typedb, typ1->identifier.name);
192  RzBaseType *btyp2 = rz_type_db_get_base_type(typedb, typ2->identifier.name);
193  if (!btyp1 || !btyp2) {
194  return false;
195  }
197  return btyp1->name == btyp2->name && btyp1->size == btyp2->size;
198  // TODO: Should we also compare the btyp->type?
199 }
200 
208 RZ_API bool rz_type_atomic_str_eq(const RzTypeDB *typedb, RZ_NONNULL const RzType *typ1, RZ_NONNULL const char *name) {
209  // We aim to compare only atomic types, we can't compare more complex ones for now
210  rz_return_val_if_fail(typ1 && name, false);
211  rz_return_val_if_fail(typ1->kind == RZ_TYPE_KIND_IDENTIFIER, false);
212  rz_return_val_if_fail(typ1->identifier.kind == RZ_TYPE_IDENTIFIER_KIND_UNSPECIFIED, false);
213  rz_return_val_if_fail(typ1->identifier.name, false);
214  RzBaseType *btyp1 = rz_type_db_get_base_type(typedb, typ1->identifier.name);
215  RzBaseType *btyp2 = rz_type_db_get_base_type(typedb, name);
216  if (!btyp1 || !btyp2) {
217  return false;
218  }
220  return btyp1->name == btyp2->name && btyp1->size == btyp2->size;
221  // TODO: Should we also compare the btyp->type?
222 }
223 
224 // Here we provide helpers for some commonly used RzTypes for use within the analysis
225 
233  rz_return_val_if_fail(type, false);
234  if (type->kind != RZ_TYPE_KIND_IDENTIFIER) {
235  return false;
236  }
237  return !strcmp(type->identifier.name, "void");
238 }
239 
247  rz_return_val_if_fail(type, false);
248  if (type->kind != RZ_TYPE_KIND_IDENTIFIER) {
249  return false;
250  }
251  return type->identifier.is_const;
252 }
253 
261  rz_return_val_if_fail(type, false);
262  if (type->kind != RZ_TYPE_KIND_POINTER) {
263  return false;
264  }
265  return type->pointer.is_const;
266 }
267 
268 static bool type_is_atomic_ptr(RZ_NONNULL const RzType *type, RZ_NONNULL const char *name) {
269  rz_return_val_if_fail(type && name, false);
270  if (type->kind != RZ_TYPE_KIND_POINTER) {
271  return false;
272  }
273  // There should not exist pointers to the empty types
274  RzType *ptr = type->pointer.type;
275  rz_return_val_if_fail(ptr, false);
276  return ptr->kind == RZ_TYPE_KIND_IDENTIFIER && ptr->identifier.kind == RZ_TYPE_IDENTIFIER_KIND_UNSPECIFIED && !strcmp(ptr->identifier.name, name);
277 }
278 
279 static bool type_is_atomic_ptr_nested(RZ_NONNULL const RzType *type, RZ_NONNULL const char *name) {
280  rz_return_val_if_fail(type && name, false);
281  if (type->kind != RZ_TYPE_KIND_POINTER) {
282  return false;
283  }
284  // There should not exist pointers to the empty types
285  RzType *ptr = type->pointer.type;
286  rz_return_val_if_fail(ptr, false);
287  if (ptr->kind == RZ_TYPE_KIND_POINTER) {
288  return type_is_atomic_ptr_nested(ptr, name);
289  }
290  return ptr->kind == RZ_TYPE_KIND_IDENTIFIER && ptr->identifier.kind == RZ_TYPE_IDENTIFIER_KIND_UNSPECIFIED && !strcmp(ptr->identifier.name, name);
291 }
292 
299  rz_return_val_if_fail(type, false);
300  return type_is_atomic_ptr(type, "void");
301 }
302 
309  rz_return_val_if_fail(type, false);
310  return type_is_atomic_ptr_nested(type, "void");
311 }
312 
319  rz_return_val_if_fail(type, false);
320  return type_is_atomic_ptr(type, "char");
321 }
322 
329  rz_return_val_if_fail(type, false);
330  return type_is_atomic_ptr_nested(type, "char");
331 }
332 
339  rz_return_val_if_fail(type, false);
340  return type->kind == RZ_TYPE_KIND_IDENTIFIER;
341 }
342 
350  rz_return_val_if_fail(type, false);
351  if (type->kind != RZ_TYPE_KIND_IDENTIFIER) {
352  return false;
353  }
354  if (type->identifier.kind != RZ_TYPE_IDENTIFIER_KIND_UNSPECIFIED) {
355  return false;
356  }
357  rz_return_val_if_fail(type->identifier.name, false);
358  RzBaseType *btyp = rz_type_db_get_base_type(typedb, type->identifier.name);
359  if (!btyp) {
360  return false;
361  }
362  return btyp->kind == RZ_BASE_TYPE_KIND_ATOMIC;
363 }
364 
371 RZ_API bool rz_type_is_atomic(const RzTypeDB *typedb, RZ_NONNULL const RzType *type) {
372  rz_return_val_if_fail(type, false);
373  if (type->kind == RZ_TYPE_KIND_POINTER) {
374  return rz_type_is_atomic(typedb, type->pointer.type);
375  }
376  if (type->kind == RZ_TYPE_KIND_ARRAY) {
377  return rz_type_is_atomic(typedb, type->array.type);
378  }
379  if (type->kind != RZ_TYPE_KIND_IDENTIFIER) {
380  return false;
381  }
382  if (type->identifier.kind != RZ_TYPE_IDENTIFIER_KIND_UNSPECIFIED) {
383  return false;
384  }
385  rz_return_val_if_fail(type->identifier.name, false);
386  RzBaseType *btyp = rz_type_db_get_base_type(typedb, type->identifier.name);
387  if (!btyp) {
388  return false;
389  }
390  return btyp->kind == RZ_BASE_TYPE_KIND_ATOMIC;
391 }
392 
400  rz_return_val_if_fail(type, false);
401  if (type->kind != RZ_TYPE_KIND_IDENTIFIER) {
402  return false;
403  }
404  if (type->identifier.kind != RZ_TYPE_IDENTIFIER_KIND_UNSPECIFIED) {
405  return false;
406  }
407  return !strcmp(type->identifier.name, typedb->target->default_type) && !type->identifier.is_const;
408 }
409 
416  rz_return_val_if_fail(typedb, NULL);
417  RzBaseType *btype = rz_type_db_get_base_type(typedb, typedb->target->default_type);
418  if (!btype) {
419  return NULL;
420  }
421  return rz_type_identifier_of_base_type(typedb, btype, false);
422 }
423 
430 RZ_API bool rz_type_integral_set_sign(const RzTypeDB *typedb, RZ_NONNULL RzType **type, bool sign) {
431  rz_return_val_if_fail(type && *type, false);
432  RzType *t = *type;
433  if (t->kind != RZ_TYPE_KIND_IDENTIFIER) {
434  return false;
435  }
436  if (rz_type_is_integral(typedb, t)) {
437  const char *identifier = rz_type_identifier(t);
438  if (!identifier) {
439  return false;
440  }
441  RzBaseType *btype = rz_type_db_get_base_type(typedb, identifier);
442  if (!btype) {
443  return false;
444  }
446  // We only change typesubclass if it's different from the current one
447  if (rz_base_type_typeclass(typedb, btype) == typesubclass) {
448  return true;
449  }
450  size_t typesize = rz_type_db_base_get_bitsize(typedb, btype);
451  RzBaseType *signedbtype = rz_type_typeclass_get_default_sized(typedb, typesubclass, typesize);
452  if (!signedbtype) {
453  return false;
454  }
455  RzType *signedtype = rz_type_identifier_of_base_type(typedb, signedbtype, false);
456  if (!signedtype) {
457  return false;
458  }
459  rz_type_free(t);
460  *type = signedtype;
461  }
462  return false;
463 }
464 
472  switch (cc) {
473  case RZ_TYPE_COND_EQ: return "eq";
474  case RZ_TYPE_COND_NV: return "nv";
475  case RZ_TYPE_COND_NE: return "ne";
476  case RZ_TYPE_COND_HS: return "hs";
477  case RZ_TYPE_COND_LO: return "lo";
478  case RZ_TYPE_COND_MI: return "mi";
479  case RZ_TYPE_COND_PL: return "pl";
480  case RZ_TYPE_COND_VS: return "vs";
481  case RZ_TYPE_COND_VC: return "vc";
482  case RZ_TYPE_COND_HI: return "hi";
483  case RZ_TYPE_COND_LS: return "ls";
484  case RZ_TYPE_COND_GE: return "ge";
485  case RZ_TYPE_COND_LT: return "lt";
486  case RZ_TYPE_COND_GT: return "gt";
487  case RZ_TYPE_COND_LE: return "le";
488  case RZ_TYPE_COND_AL: return "al";
489  case RZ_TYPE_COND_HEX_SCL_TRUE: return "scl-t";
490  case RZ_TYPE_COND_HEX_SCL_FALSE: return "scl-f";
491  case RZ_TYPE_COND_HEX_VEC_TRUE: return "vec-t";
492  case RZ_TYPE_COND_HEX_VEC_FALSE: return "vec-f";
493  case RZ_TYPE_COND_EXCEPTION: return "excptn";
494  }
495  return "??";
496 }
497 
505  switch (cond) {
506  case RZ_TYPE_COND_LE:
507  return RZ_TYPE_COND_GT;
508  case RZ_TYPE_COND_LT:
509  return RZ_TYPE_COND_GE;
510  case RZ_TYPE_COND_GE:
511  return RZ_TYPE_COND_LT;
512  case RZ_TYPE_COND_GT:
513  return RZ_TYPE_COND_LE;
514  case RZ_TYPE_COND_AL:
515  return RZ_TYPE_COND_NV;
516  case RZ_TYPE_COND_NE:
517  return RZ_TYPE_COND_EQ;
518  case RZ_TYPE_COND_EQ:
519  return RZ_TYPE_COND_NE;
520  default:
522  break;
523  }
524  return 0;
525 }
535  switch (cond) {
536  case RZ_TYPE_COND_EQ: return arg0 == arg1;
537  case RZ_TYPE_COND_NE: return arg0 != arg1;
538  case RZ_TYPE_COND_GE: return arg0 >= arg1;
539  case RZ_TYPE_COND_GT: return arg0 > arg1;
540  case RZ_TYPE_COND_LE: return arg0 <= arg1;
541  case RZ_TYPE_COND_LT: return arg0 < arg1;
542  default: return false;
543  }
544  return false;
545 }
546 
555  switch (cond) {
556  case RZ_TYPE_COND_EQ: return !arg0;
557  case RZ_TYPE_COND_NE: return arg0;
558  case RZ_TYPE_COND_GT: return arg0 > 0;
559  case RZ_TYPE_COND_GE: return arg0 >= 0;
560  case RZ_TYPE_COND_LT: return arg0 < 0;
561  case RZ_TYPE_COND_LE: return arg0 <= 0;
562  default: return false;
563  }
564  return false;
565 }
RZ_API RZ_BORROW RzBaseType * rz_type_db_get_base_type(const RzTypeDB *typedb, RZ_NONNULL const char *name)
Searches for the RzBaseType in the types database given the name.
Definition: base.c:57
#define RZ_API
#define NULL
Definition: cris-opc.c:27
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void count
Definition: sflib.h:98
RZ_API bool rz_type_is_identifier(RZ_NONNULL const RzType *type)
Checks if the RzType is identifier.
Definition: helpers.c:338
RZ_API bool rz_type_is_char_ptr_nested(RZ_NONNULL const RzType *type)
Checks if the pointer RzType is a nested pointer of string ("char **", "char ***",...
Definition: helpers.c:328
static bool type_is_atomic_ptr(RZ_NONNULL const RzType *type, RZ_NONNULL const char *name)
Definition: helpers.c:268
RZ_API RZ_OWN RzType * rz_type_pointer_of_base_type_str(const RzTypeDB *typedb, RZ_NONNULL const char *name, bool is_const)
Creates a new pointer RzType from the given RzBaseType name.
Definition: helpers.c:86
RZ_API bool rz_type_is_void_ptr_nested(RZ_NONNULL const RzType *type)
Checks if the pointer RzType is a nested abstract pointer ("void **", "vpod ***", etc)
Definition: helpers.c:308
RZ_API RzTypeCond rz_type_cond_invert(RzTypeCond cond)
return the inverted condition
Definition: helpers.c:504
RZ_API bool rz_type_atomic_str_eq(const RzTypeDB *typedb, RZ_NONNULL const RzType *typ1, RZ_NONNULL const char *name)
Checks if two atomic types (RzType and RzBaseType) are equivalent.
Definition: helpers.c:208
RZ_API bool rz_type_pointer_is_const(const RzTypeDB *typedb, RZ_NONNULL const RzType *type)
Checks if the pointer RzType is "const".
Definition: helpers.c:260
RZ_API bool rz_type_is_strictly_atomic(const RzTypeDB *typedb, RZ_NONNULL const RzType *type)
Checks if the RzType is strictly atomic.
Definition: helpers.c:349
RZ_API RZ_OWN RzType * rz_type_identifier_of_base_type(const RzTypeDB *typedb, RZ_NONNULL const RzBaseType *btype, bool is_const)
Creates a new RzType indentifier from the given RzBaseType.
Definition: helpers.c:15
RZ_API RZ_BORROW const char * rz_type_cond_tostring(RzTypeCond cc)
RzTypeCond enum to string.
Definition: helpers.c:471
RZ_API RZ_OWN RzType * rz_type_array_of_base_type(const RzTypeDB *typedb, RZ_NONNULL const RzBaseType *btype, size_t count)
Creates a new array RzType from the given RzBaseType.
Definition: helpers.c:124
RZ_API bool rz_type_is_atomic(const RzTypeDB *typedb, RZ_NONNULL const RzType *type)
Checks if the RzType is atomic or derivative of it.
Definition: helpers.c:371
RZ_API bool rz_type_is_void_ptr(RZ_NONNULL const RzType *type)
Checks if the pointer RzType is abstract pointer ("void *")
Definition: helpers.c:298
RZ_API RZ_OWN RzType * rz_type_pointer_of_base_type(const RzTypeDB *typedb, RZ_NONNULL const RzBaseType *btype, bool is_const)
Creates a new pointer RzType from the given RzBaseType.
Definition: helpers.c:63
RZ_API RZ_OWN RzType * rz_type_array_of_type(const RzTypeDB *typedb, RZ_NONNULL RzType *type, size_t count)
Creates a new array RzType from the given RzType.
Definition: helpers.c:163
static bool type_is_atomic_ptr_nested(RZ_NONNULL const RzType *type, RZ_NONNULL const char *name)
Definition: helpers.c:279
RZ_API bool rz_type_atomic_is_const(const RzTypeDB *typedb, RZ_NONNULL const RzType *type)
Checks if the atomic RzType is "const".
Definition: helpers.c:246
RZ_API RZ_OWN RzType * rz_type_array_of_base_type_str(const RzTypeDB *typedb, RZ_NONNULL const char *name, size_t count)
Creates a new array RzType from the given RzBaseType name.
Definition: helpers.c:147
RZ_API bool rz_type_is_default(const RzTypeDB *typedb, RZ_NONNULL const RzType *type)
Checks if the RzType is default.
Definition: helpers.c:399
RZ_API RZ_OWN RzType * rz_type_new_default(const RzTypeDB *typedb)
Creates a new instance of the default RzType type.
Definition: helpers.c:415
RZ_API RZ_OWN RzType * rz_type_pointer_of_type(const RzTypeDB *typedb, RZ_NONNULL RzType *type, bool is_const)
Creates a new pointer RzType from the given RzType.
Definition: helpers.c:102
RZ_API bool rz_type_atomic_is_void(const RzTypeDB *typedb, RZ_NONNULL const RzType *type)
Checks if the RzType is "void".
Definition: helpers.c:232
RZ_API bool rz_type_cond_eval_single(RzTypeCond cond, st64 arg0)
Same as rz_type_cond_eval, but it assumes arg1 to be 0.
Definition: helpers.c:554
RZ_API bool rz_type_is_char_ptr(RZ_NONNULL const RzType *type)
Checks if the pointer RzType is a string ("char *" or "const char *")
Definition: helpers.c:318
RZ_API bool rz_type_integral_set_sign(const RzTypeDB *typedb, RZ_NONNULL RzType **type, bool sign)
If the type is unsigned it sets the sign.
Definition: helpers.c:430
RZ_API bool rz_type_cond_eval(RzTypeCond cond, st64 arg0, st64 arg1)
evaluate the type condition on the arguments and return a bool accordingly.
Definition: helpers.c:534
RZ_API RZ_OWN RzType * rz_type_identifier_of_base_type_str(const RzTypeDB *typedb, RZ_NONNULL const char *name)
Creates a new RzType indentifier from the given RzBaseType name.
Definition: helpers.c:47
RZ_API bool rz_type_atomic_eq(const RzTypeDB *typedb, RZ_NONNULL const RzType *typ1, RZ_NONNULL const RzType *typ2)
Checks if two atomic RzTypes are equivalent.
Definition: helpers.c:183
return strdup("=SP r13\n" "=LR r14\n" "=PC r15\n" "=A0 r0\n" "=A1 r1\n" "=A2 r2\n" "=A3 r3\n" "=ZF zf\n" "=SF nf\n" "=OF vf\n" "=CF cf\n" "=SN or0\n" "gpr lr .32 56 0\n" "gpr pc .32 60 0\n" "gpr cpsr .32 64 0 ____tfiae_________________qvczn\n" "gpr or0 .32 68 0\n" "gpr tf .1 64.5 0 thumb\n" "gpr ef .1 64.9 0 endian\n" "gpr jf .1 64.24 0 java\n" "gpr qf .1 64.27 0 sticky_overflow\n" "gpr vf .1 64.28 0 overflow\n" "gpr cf .1 64.29 0 carry\n" "gpr zf .1 64.30 0 zero\n" "gpr nf .1 64.31 0 negative\n" "gpr itc .4 64.10 0 if_then_count\n" "gpr gef .4 64.16 0 great_or_equal\n" "gpr r0 .32 0 0\n" "gpr r1 .32 4 0\n" "gpr r2 .32 8 0\n" "gpr r3 .32 12 0\n" "gpr r4 .32 16 0\n" "gpr r5 .32 20 0\n" "gpr r6 .32 24 0\n" "gpr r7 .32 28 0\n" "gpr r8 .32 32 0\n" "gpr r9 .32 36 0\n" "gpr r10 .32 40 0\n" "gpr r11 .32 44 0\n" "gpr r12 .32 48 0\n" "gpr r13 .32 52 0\n" "gpr r14 .32 56 0\n" "gpr r15 .32 60 0\n" "gpr r16 .32 64 0\n" "gpr r17 .32 68 0\n")
int type
Definition: mipsasm.c:17
#define rz_warn_if_reached()
Definition: rz_assert.h:29
#define rz_return_val_if_fail(expr, val)
Definition: rz_assert.h:108
@ RZ_BASE_TYPE_KIND_ATOMIC
Definition: rz_type.h:77
@ RZ_BASE_TYPE_KIND_UNION
Definition: rz_type.h:74
@ RZ_BASE_TYPE_KIND_STRUCT
Definition: rz_type.h:73
@ RZ_BASE_TYPE_KIND_ENUM
Definition: rz_type.h:75
@ RZ_TYPE_IDENTIFIER_KIND_STRUCT
Definition: rz_type.h:136
@ RZ_TYPE_IDENTIFIER_KIND_UNSPECIFIED
Definition: rz_type.h:135
@ RZ_TYPE_IDENTIFIER_KIND_ENUM
Definition: rz_type.h:138
@ RZ_TYPE_IDENTIFIER_KIND_UNION
Definition: rz_type.h:137
RzTypeTypeclass
Definition: rz_type.h:61
@ RZ_TYPE_TYPECLASS_INTEGRAL_SIGNED
Definition: rz_type.h:67
@ RZ_TYPE_TYPECLASS_INTEGRAL_UNSIGNED
Definition: rz_type.h:68
RzTypeCond
Type Conditions.
Definition: rz_type.h:182
@ RZ_TYPE_COND_LO
Carry clear Less than.
Definition: rz_type.h:192
@ RZ_TYPE_COND_VS
Overflow Unordered.
Definition: rz_type.h:195
@ RZ_TYPE_COND_HEX_SCL_TRUE
Definition: rz_type.h:199
@ RZ_TYPE_COND_LE
Less or equal.
Definition: rz_type.h:188
@ RZ_TYPE_COND_GE
Greater or equal.
Definition: rz_type.h:186
@ RZ_TYPE_COND_HEX_VEC_TRUE
Definition: rz_type.h:201
@ RZ_TYPE_COND_VC
No overflow Not unordered.
Definition: rz_type.h:196
@ RZ_TYPE_COND_HEX_SCL_FALSE
Definition: rz_type.h:200
@ RZ_TYPE_COND_LS
Unsigned lower or same Less than or equal.
Definition: rz_type.h:198
@ RZ_TYPE_COND_NV
Never executed must be a nop? :D.
Definition: rz_type.h:190
@ RZ_TYPE_COND_EQ
Equal.
Definition: rz_type.h:184
@ RZ_TYPE_COND_HS
Carry set >, ==, or unordered.
Definition: rz_type.h:191
@ RZ_TYPE_COND_NE
Not equal.
Definition: rz_type.h:185
@ RZ_TYPE_COND_AL
Always executed (no condition)
Definition: rz_type.h:183
@ RZ_TYPE_COND_MI
Minus, negative Less than.
Definition: rz_type.h:193
@ RZ_TYPE_COND_HI
Unsigned higher Greater than, or unordered.
Definition: rz_type.h:197
@ RZ_TYPE_COND_GT
Greater than.
Definition: rz_type.h:187
@ RZ_TYPE_COND_HEX_VEC_FALSE
Definition: rz_type.h:202
@ RZ_TYPE_COND_PL
Plus, positive or zero >, ==, or unordered.
Definition: rz_type.h:194
@ RZ_TYPE_COND_LT
Less than.
Definition: rz_type.h:189
@ RZ_TYPE_COND_EXCEPTION
Definition: rz_type.h:203
@ RZ_TYPE_KIND_ARRAY
Definition: rz_type.h:130
@ RZ_TYPE_KIND_IDENTIFIER
Definition: rz_type.h:128
@ RZ_TYPE_KIND_POINTER
Definition: rz_type.h:129
#define RZ_OWN
Definition: rz_types.h:62
#define RZ_NEW0(x)
Definition: rz_types.h:284
#define RZ_NONNULL
Definition: rz_types.h:64
#define RZ_BORROW
Definition: rz_types.h:63
#define st64
Definition: rz_types_base.h:10
#define cond(bop, top, mask, flags)
Definition: z80asm.h:102
char * name
Definition: rz_type.h:112
RzBaseTypeKind kind
Definition: rz_type.h:115
RzTypeTarget * target
Definition: rz_type.h:36
RzTypeKind kind
Definition: rz_type.h:155
struct rz_type_t::@292::@295 pointer
struct rz_type_t::@292::@294 identifier
struct rz_type_t::@292::@296 array
const char * default_type
Definition: rz_type.h:26
RZ_API ut64 rz_type_db_base_get_bitsize(const RzTypeDB *typedb, RZ_NONNULL RzBaseType *btype)
Returns the base type size in bits (target dependent)
Definition: type.c:755
RZ_API RZ_BORROW const char * rz_type_identifier(RZ_NONNULL const RzType *type)
Returns the type C identifier.
Definition: type.c:1155
RZ_API void rz_type_free(RZ_NULLABLE RzType *type)
Frees the RzType.
Definition: type.c:1273
RZ_API bool rz_type_is_integral(const RzTypeDB *typedb, RZ_NONNULL const RzType *type)
Checks if the RzType is Integral typeclass.
Definition: typeclass.c:218
RZ_API RZ_OWN RzBaseType * rz_type_typeclass_get_default_sized(const RzTypeDB *typedb, RzTypeTypeclass typeclass, size_t size)
Returns the default base type given the typeclass and size.
Definition: typeclass.c:370
RZ_API RzTypeTypeclass rz_base_type_typeclass(const RzTypeDB *typedb, RZ_NONNULL const RzBaseType *type)
Gets the base type class.
Definition: typeclass.c:147