4 ms·
I can't say I've ever seen a lookup table method for that, going right back to implementing that kind of function on 8-bit CPUs. Are you sure you're not just u
by Gordonjcp 4y ago
I can't say I've ever seen a lookup table method for that, going right back to implementing that kind of function on 8-bit CPUs.
Are you sure you're not just used to shitty code?
- tialaramex 4y agoGNU libc is an example of a relatively well known isxdigit() which uses a LUT even today. Its excuse is that this simplifies locale handling, you know for if your locale has hexadecimal digits in a different place from everybody else, presumably because you're from some alternate universe where Z is a hex digit.
- litoE 4y agoBut isn't that just a bad implementation in libc, rather than a problem with C itself? It should be trivial to rewrite isxdigit() copying rust's algorithm in C.
- Gordonjcp 4y agoOr, you know, MIKBUG's implementation.
- torstenvl 4y agoThis is a problem with glibc (it's also a violation of the C standard, since isxdigit is explicitly not affected by the current locale). Other C libraries don't have this problem. http://git.musl-libc.org/cgit/musl/plain/src/ctype/isxdigit.c?id=6582baa752a8facb2c8a7b5b3dcf67331429cdc1 http://git.musl-libc.org/cgit/musl/plain/src/ctype/isxdigit....
- deleted 4y ago[deleted]