4 ms·
Not discussed here - there's literally BCD instructions on x86 that take an ASCII string and treat it as a number. I don't know of performance though since thes
by AnotherGoodName 6y ago
Not discussed here - there's literally BCD instructions on x86 that take an ASCII string and treat it as a number. I don't know of performance though since these instructions are definitely archaic.
- deleted 6y ago[deleted]
- deleted 6y ago[deleted]
- maximilianburke 6y agoThe x86 BCD instructions aren't supported in long mode.
- vardump 6y agoBCD is Binary Coded Decimal. Not ASCII. 0x12345678 BCD is 12345678 in decimal. https://en.wikipedia.org/wiki/Binary-coded_decimal https://en.wikipedia.org/wiki/Binary-coded_decimal
- AnotherGoodName 6y agoOn Intel unpacked BCD was specifically for working with numbers written in ASCII. https://en.wikipedia.org/wiki/Intel_BCD_opcode https://en.wikipedia.org/wiki/Intel_BCD_opcode
- vardump 6y agoDamn, and I thought I knew all about x86 assembler... never noticed unpacked BCD before.
- kens 6y agoThe 8087 floating point coprocessor has the FBLD instruction to load an 18-digit BCD number and FIST to store an integer. So once you convert from ASCII to BCD, the remaining conversion is two instructions. This is probably the most efficient way to do the parsing, if you're in 1980.