4 ms·
Do library atoi() actually do SIMD?
by ape4 3y ago
Do library atoi() actually do SIMD?
- vinkelhake 3y agoThat would depend on the implementation. But it doesn't really matter, no one should be using atoi.
- stingraycharles 3y agoYeah, iirc it was exploitable because it doesn’t do any bounds checking or something like that, right?
- Lt_Riza_Hawkeye 3y agoIt bounds checks just fine, as long as you pass it a null-terminated string. It just returns 0 on error, so there's no way to know if the string was for example, larger than would fit in an int, or even just totally invalid, or if the user actually entered 0.
- anonymoushn 3y agoIn general almost nothing uses SIMD for processing strings :(
- jzwinck 3y agoNot literally atoi() because most people don't use that anymore, but the C++ std::from_chars() uses SIMD in GCC 12+, thanks to some of the same people behind the OP: https://lemire.me/blog/2022/07/27/comparing-strtod-with-from_chars-gcc-12/ https://lemire.me/blog/2022/07/27/comparing-strtod-with-from...