Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #11071 - Implement 1u8, 1u16, 1u32, 1u64 in RNum #11765

Merged
merged 1 commit into from Oct 8, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 12 additions & 1 deletion libr/util/unum.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down