Currently many rz_num_*() functions return ut64/st64 which is not enough to work with big numbers, bitvectors, floats. Thus, we need to introduce the abstract notion of the number, lets call it RzNumValue that could be either ut64/st64 (if small enough) or bitvector/bignum (otherwise), or float/bigfloat/etc underneath. Then all arithmetic operations should be implemented on top of these numbers, plus functions that try to get the value from it, plus printing functions, e.g. char *rz_num_to_string(RzNum *num, RzNumValue *number). Since rz_num_math() is commonly used, rename it to rz_num_math_ut64() and perform the switch to the new API slowly, place by place, only where it's necessary (in many situations it isn't - e.g. calculation of addresses or sizes). First and foremost, the new API should be used in rz-ax and everywhere related to RzIL.
Currently many
rz_num_*()
functions returnut64
/st64
which is not enough to work with big numbers, bitvectors, floats. Thus, we need to introduce the abstract notion of the number, lets call itRzNumValue
that could be eitherut64
/st64
(if small enough) or bitvector/bignum (otherwise), or float/bigfloat/etc underneath. Then all arithmetic operations should be implemented on top of these numbers, plus functions that try to get the value from it, plus printing functions, e.g.char *rz_num_to_string(RzNum *num, RzNumValue *number)
. Sincerz_num_math()
is commonly used, rename it torz_num_math_ut64()
and perform the switch to the new API slowly, place by place, only where it's necessary (in many situations it isn't - e.g. calculation of addresses or sizes). First and foremost, the new API should be used inrz-ax
and everywhere related toRzIL
.Affected files:
librz/util/unum.c
librz/util/calc.c
librz/include/rz_util/rz_num.h
See these APIs:
librz/include/rz_util/rz_bitvector.h
librz/include/rz_util/rz_big.h