Hacker News new | ask | show | jobs
by haxen 831 days ago
This post explains a piece of code that appeared on the recent One Billion Row Challenge, it parses a variable-layout string whose bytes are packed into a single 64-bit variable, and doesn't use any if statements to achieve it. The string represents a decimal number from the range [-99.9, 99.9].

The general class of techniques used is called SWAR -- SIMD Within A Register, because it uses the regular ALU instruction set to achieve the effect of SIMD (Single Instruction, Multiple Data).

The code in question was submitted by Quan Anh Mai (@merykitty on GitHub).