by MirekCz » Feb 22, 2002 @ 12:00am
plan9:hmm, althrought I don't understand much from this effective blue thingy(huh, what is it about?!?) I can tell you that you're pretty false about your assumptions that a shift won't do to change a 565 into 332.
You can achieve it like this:
bad way:
0011b >> 2 = 00b
good way:
(0011b+0010b) >> 2 = 0101b >> 2 = 01b
How it works? we simple added half of the number representing 1 , and therefore a (will use floats) 0.9f won't become 0, but will become 0.9f+0.5f=1.4f so 1.
Conclusion? one simlpe add and you can still live pretty nicely with some shifts/ands, which might be better then your version (no concerns about trashing cache, not finding a value in cache which then starts a slow sysmem read etc etc)
hope it helps:)
With best regards,
Mirek Czerwinski