Previously assumed normalised was 0 to 1, but it can be -1 to 1
if type is signed.
Tested with lp_test_conv and lp_test_format, reduced errors.
Signed-off-by: José Fonseca <jfonseca@vmware.com>
if(a == b)
return a;
- if(bld->type.norm) {
- if(a == bld->zero || b == bld->zero)
- return bld->zero;
+ if (bld->type.norm) {
+ if (!bld->type.sign) {
+ if (a == bld->zero || b == bld->zero) {
+ return bld->zero;
+ }
+ }
if(a == bld->one)
return b;
if(b == bld->one)
if(bld->type.norm) {
if(a == bld->one || b == bld->one)
return bld->one;
- if(a == bld->zero)
- return b;
- if(b == bld->zero)
- return a;
+ if (!bld->type.sign) {
+ if (a == bld->zero) {
+ return b;
+ }
+ if (b == bld->zero) {
+ return a;
+ }
+ }
}
return lp_build_max_simple(bld, a, b);