summaryrefslogtreecommitdiffstats
path: root/src/map/if
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2017-07-01 13:48:31 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2017-07-01 13:48:31 -0700
commitbf6a053c648576c1e5493f2d5390eb78b2e3df1c (patch)
tree19c0e561e0d56178c40bb1030ccd738fa5455501 /src/map/if
parenta1dd7e3fb04660e025f8cb37eb2636d3d700c3ac (diff)
downloadabc-bf6a053c648576c1e5493f2d5390eb78b2e3df1c.tar.gz
abc-bf6a053c648576c1e5493f2d5390eb78b2e3df1c.tar.bz2
abc-bf6a053c648576c1e5493f2d5390eb78b2e3df1c.zip
Saturating floating point computation.
Diffstat (limited to 'src/map/if')
-rw-r--r--src/map/if/ifCut.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/map/if/ifCut.c b/src/map/if/ifCut.c
index 9b8d75ad..667a21c5 100644
--- a/src/map/if/ifCut.c
+++ b/src/map/if/ifCut.c
@@ -919,18 +919,22 @@ void If_CutLift( If_Cut_t * pCut )
float If_CutAreaFlow( If_Man_t * p, If_Cut_t * pCut )
{
If_Obj_t * pLeaf;
- float Flow;
+ float Flow, AddOn;
int i;
Flow = If_CutLutArea(p, pCut);
If_CutForEachLeaf( p, pCut, pLeaf, i )
{
if ( pLeaf->nRefs == 0 || If_ObjIsConst1(pLeaf) )
- Flow += If_ObjCutBest(pLeaf)->Area;
+ AddOn = If_ObjCutBest(pLeaf)->Area;
else
{
assert( pLeaf->EstRefs > p->fEpsilon );
- Flow += If_ObjCutBest(pLeaf)->Area / pLeaf->EstRefs;
+ AddOn = If_ObjCutBest(pLeaf)->Area / pLeaf->EstRefs;
}
+ if ( Flow >= (float)1e32 || AddOn >= (float)1e32 )
+ Flow = (float)1e32;
+ else
+ Flow += AddOn;
}
return Flow;
}