Tim Goetze wrote:
[Tim Blechmann]
On Fri, 25 Jun 2004 17:38:24 -0500 Jan Depner <[EMAIL PROTECTED]> wrote:
On Fri, 2004-06-25 at 13:49, Tim Blechmann wrote:
I have a denormal fix without a branch but you probably don't want
to see it ;-)
It's pretty simple, just OR the bits of the exponent together
which gives either
0 (denormal) or 1, typecast that to float, and then multiply the
original float by that (0.0 or 1.0). Voila, no branch, but it is
messy looking ;-)
indeed sounds more like a fun proposal; nonetheless i'm wondering how many cycles 'ORing the exponent bits together' would take. with an 8-bit exponent and no assumption about its value made, 8 binary 'shift', 7 'or' and 1 'and' statement if i'm not badly mistaken. and if i'm not, a branch will probably hurt less.
Three shifts, three copys, three 'or's and an 'and':
copy = value; value |= copy >> 4; copy = value; value |= copy >> 2; copy = value; value |= copy >> 1; value &= 0x01;
