1. 16
  1.  

  2. 14

    This article doesn’t list any true “hacks”, but very standard stuff (but you should definitely know them).

    Here’s a much more interesting page, imo. “Round up to the next highest power of 2 by float casting” is quite delightful. The FastInvSqrt trick and creating tiny ELF files might be counted as a “low level bit hacks” as well.

    Here’s one of my own: y[i] = u[i] + f_c * (y[i-1] - u[i]) is a lowpass filter (cutoff frequency f_c), which can be implemented using fixed-point maths quite easily, and it’s much lighter than the standard biquad filter. Though, it’s a first-order FIR filter, so the quality might be poorer.

    1. 4

      creating tiny ELF files

      Yeah, but that’s the shit in a way that also saves people bandwidth. It could potentially have wide, positive impact. :)

      1. 3

        Unless I’m much mistaken, isn’t that just an exponential moving average (with alpha=1-f_c) and therefore an IIR filter?

        y[i] = (1 - f_c) * u[i] + f_c * y[i-1]
        
        1. 2

          Whoops, you seem to be right. But it works, so I don’t complain :P.

      2. 1

        “Your computer hates this weird little trick!!!”