From 9a06d29ca0526bc43862145a694931dfb5d6b505 Mon Sep 17 00:00:00 2001 From: radare Date: Mon, 8 Oct 2018 09:49:44 +0200 Subject: [PATCH] Fix #11071 - Implement 1u8, 1u16, 1u32, 1u64 in RNum (#11765) --- libr/util/unum.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/libr/util/unum.c b/libr/util/unum.c index dc777f9390a0b..6ac41a863e4c4 100644 --- a/libr/util/unum.c +++ b/libr/util/unum.c @@ -51,7 +51,7 @@ R_API void r_num_minmax_swap(ut64 *a, ut64 *b) { } R_API void r_num_minmax_swap_i(int *a, int *b) { - if (*a>*b) { + if (*a > *b) { ut64 tmp = *a; *a = *b; *b = tmp; @@ -146,6 +146,17 @@ R_API ut64 r_num_get(RNum *num, const char *str) { if (!*str) { return 0; } + if (!strncmp (str, "1u", 2)) { // '1' is captured by op :( + if (num->value == UT64_MAX) { + num->value = 0; + } + switch (atoi (str + 2)) { + case 64: return (ut64)UT64_MAX; + case 32: return (ut64)UT32_MAX; + case 16: return (ut64)UT16_MAX; + case 8: return (ut64)UT8_MAX; + } + } /* resolve string with an external callback */ if (num && num->callback) { ok = 0;