We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
It would be interesting to extend the entry of prefixed integers as exists in hexadecimal:
$1s2b3c
to other numbers in binary:
%10101101
or in decimal:
#2024
Simply modify the convert() code
static cell_t convert(const char *pos, cell_t n, cell_t base, cell_t *ret) { *ret = 0; cell_t negate = 0; if (!n) { return 0; } if (*pos == '-') { negate = -1; ++pos; --n; } if (*pos == '$') { base = 16; ++pos; --n; } if (*pos == '%') { base = 2; ++pos; --n; } if (*pos == '#') { base = 10; ++pos; --n; } for (; n; --n) { uintptr_t d = UPPER(*pos) - '0'; if (d > 9) { d -= 7; if (d < 10) { return 0; } } if (d >= (uintptr_t) base) { return 0; } *ret = *ret * base + d; ++pos; } if (negate) { *ret = -*ret; } return -1; }
I've adding only two lines:
if (*pos == '%') { base = 2; ++pos; --n; } if (*pos == '#') { base = 10; ++pos; --n; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
It would be interesting to extend the entry of prefixed integers as exists in hexadecimal:
$1s2b3c
to other numbers in binary:
%10101101
or in decimal:
#2024
Simply modify the convert() code
I've adding only two lines:
if (*pos == '%') { base = 2; ++pos; --n; }
if (*pos == '#') { base = 10; ++pos; --n; }
The text was updated successfully, but these errors were encountered: