Expand description
Rust fast &str to integer parser (x86_64 SIMD, SSE4.1, AVX2)
Must be used when you are certain that the string contains only digits. If you pass not only digits, it will give you the wrong output (not error).
The 64 bit functions use SSE4.1, max string length is 16 numbers (17 with sign).
The 128 bit functions use AVX2, max string length is 32 numbers (33 with sign).
Examples
assert_eq!(atoi_simd::parse("0").unwrap(), 0_u64);
assert_eq!(atoi_simd::parse("1234").unwrap(), 1234_u64);
assert_eq!(atoi_simd::parse_i64("2345").unwrap(), 2345_i64);
assert_eq!(atoi_simd::parse_i64("-2345").unwrap(), -2345_i64);
assert_eq!(atoi_simd::parse_u128("1234").unwrap(), 1234_u128);
assert_eq!(atoi_simd::parse_i128("2345").unwrap(), 2345_i128);
assert_eq!(atoi_simd::parse_i128("-1234").unwrap(), -1234_i128);Structs
Functions
Parses string of only digits. String length must be 1..=16. Uses SSE4.1 intrinsics
Parses string of only digits and first ‘-’ char.
String length (except ‘-’ char) must be 1..=16.
This function is slower than parse(), because it checks for ‘-’ sign.
Uses SSE4.1 intrinsics
Parses string of only digits and first ‘-’ char.
String length (except ‘-’ char) must be 1..=32.
This function is slower than parse_u128(), because it checks for ‘-’ sign.
Uses AVX/AVX2 intrinsics
Parses string of only digits. String length must be 1..=32. Uses AVX/AVX2 intrinsics