gallivm: add a version of log2 which handles edge cases 00/7600/1
authorZack Rusin <zackr@vmware.com>
Tue, 16 Jul 2013 19:57:11 +0000 (15:57 -0400)
committerZack Rusin <zackr@vmware.com>
Fri, 19 Jul 2013 20:29:17 +0000 (16:29 -0400)
commit13e2cd2f2ccb06cd6dc9acda0b6bbe268ee37879
treec05af0756b62860ecda3a8b97ab9b7d33c072cba
parent7b672c1503abffcc83a30a9731419539f52ac73f
gallivm: add a version of log2 which handles edge cases

That means that if input is:
 * - less than zero (to and including -inf) then NaN will be returned
 * - equal to zero (-denorm, -0, +0 or +denorm), then -inf will be returned
 * - +infinity, then +infinity will be returned
 * - NaN, then NaN will be returned
It's a separate function because the checks are a little bit costly
and in most cases are likely unnecessary.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
src/gallium/auxiliary/gallivm/lp_bld_arit.c
src/gallium/auxiliary/gallivm/lp_bld_arit.h
src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c