The idea is that the 8-bit input range 0..255 should map to the 16-bit output range 0..65535 ... Try the original code, compared to your suggestion;) (To be honest, multiplying by 257 did sound weird to me, too, but then I realized that 257 == 65535/255 . I would perhaps write out the 65535/255 explicitly and let the compiler fold it to 257.) --tml