All pastes #940401 Raw Edit

Untitled

public text v1 · immutable
·published 2008-03-12 23:01 UTC
rendered paste body
typedef unsigned int u32;

void f(const u32 *restrict in, u32 *restrict out)
{
        u32 x, y, z;
        u32 a, b, c;

        x = in[0];
        y = in[1];
        z = in[2];

        a = (x & 0x0000ff00) << 16
          | (x & 0x00ff0000)
          | (x & 0xff000000) >> 16
          | (y & 0x00ff0000) >> 16;
        b = (y & 0xff000000)
          | (x & 0x000000ff) << 16
          | (z & 0xff000000) >> 16
          | (y & 0x000000ff);
        c = (y & 0x0000ff00) << 16
          | (z & 0x000000ff) << 16
          | (z & 0x0000ff00)
          | (z & 0x00ff0000) >> 16;

        out[0] = a;
        out[1] = b;
        out[2] = c;
}