Is it a coincidence that all these quality life things start to pop up after C++ is facing real competition for the first time? Seems a bit odd to add print after using std::out for 30 years.
20 karma · joined November 11, 2022
fn validate_ascii(bytes: &[u8]) -> bool{
bytes.iter().fold(true, |acc, b| acc & (\*b <= 127))
}
This check will likely be the best for english text/code. You can check in varying size chunks depending on how common you think non-ascii will be. If its ascii you can move 128 bytes forward on avx2 in a couple of cycles.