diff options
author | Erik Faye-Lund <[email protected]> | 2014-02-07 13:45:10 +0100 |
---|---|---|
committer | Brian Paul <[email protected]> | 2014-02-07 08:22:14 -0700 |
commit | 7a49a796a41fa5ba3dccc2e13de43520b8d05bb6 (patch) | |
tree | cdd826067f648c2501c5458db193719d926fca7f /src | |
parent | 498d10e230663f8604d00608cae6324f779c9cdd (diff) |
gallium/tgsi: use CLAMP instead of open-coded clamps
Signed-off-by: Erik Faye-Lund <[email protected]>
Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_exec.c | 26 |
1 files changed, 4 insertions, 22 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index 3d37eaafb9d..96809cd03f5 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c @@ -914,28 +914,10 @@ micro_rcc(union tgsi_exec_channel *dst, for (i = 0; i < 4; i++) { float recip = 1.0f / src->f[i]; - if (recip > 0.0f) { - if (recip > 1.884467e+019f) { - dst->f[i] = 1.884467e+019f; - } - else if (recip < 5.42101e-020f) { - dst->f[i] = 5.42101e-020f; - } - else { - dst->f[i] = recip; - } - } - else { - if (recip < -1.884467e+019f) { - dst->f[i] = -1.884467e+019f; - } - else if (recip > -5.42101e-020f) { - dst->f[i] = -5.42101e-020f; - } - else { - dst->f[i] = recip; - } - } + if (recip > 0.0f) + dst->f[i] = CLAMP(recip, 5.42101e-020f, 1.884467e+019f); + else + dst->f[i] = CLAMP(recip, -1.884467e+019f, -5.42101e-020f); } } |