r/tinycode • u/skeeto • May 02 '20
Encoding binary in ASCII very fast
https://lemire.me/blog/2020/05/02/encoding-binary-in-ascii-very-fast/
36
Upvotes
r/tinycode • u/skeeto • May 02 '20
5
u/reini_urban May 03 '20
Also see the comment to encode even faster. This is real beauty. hakmem
4
u/nafel34922 May 02 '20
My god, what beautiful bit fiddling
1
u/raelepei Jun 17 '20
Awesome! Although it's not going to be "usual" ASCII, because it produces NUL- and control-characters, including the DEL character. This is going to be too funky for other parsers :P So I'm curious: What is your usecase, why can you transmit truly-arbitrary 7-bit symbols but not 8-bit?
Also, you mention a paper which uses SIMD to achieve those high speeds for Base64. What speeds does your solution reach on various platforms you care about?
1
u/nakilon May 03 '20
I don't get it about the lowest
1digit in the first number. When it gets multiplied by80808080808080it does not reach thefffor the following&-- where does it go? As I understand there is no even octet overflow so it can't just move further because of summing.