Index: nsUnitConversion.h =================================================================== RCS file: /cvsroot/mozilla/xpcom/ds/nsUnitConversion.h,v retrieving revision 3.10 diff -u -r3.10 nsUnitConversion.h --- nsUnitConversion.h 9 Jan 2004 04:37:19 -0000 3.10 +++ nsUnitConversion.h 2 May 2005 22:11:07 -0000 @@ -67,9 +67,17 @@ return ((0.0f <= aValue) ? nscoord(aValue + CEIL_CONST_FLOAT) : nscoord(aValue)); } -inline nscoord NSToCoordRound(float aValue) +inline nscoord NSToCoordRound(float f) { + /* return ((0.0f <= aValue) ? nscoord(aValue + ROUND_CONST_FLOAT) : nscoord(aValue - ROUND_CONST_FLOAT)); + */ + float fi; + int a[2]; + f *= (float) 1.000001; + asm("fctiw %0,%1" : "=f" (fi) : "f" (f)); + asm("stfd %1,%0" : "=m" (a) : "f" (fi)); + return a[1]; } inline nscoord NSToCoordRoundExclusive(float aValue) @@ -92,9 +100,17 @@ return ((0.0f <= aValue) ? PRInt32(aValue + CEIL_CONST_FLOAT) : PRInt32(aValue)); } -inline PRInt32 NSToIntRound(float aValue) +inline PRInt32 NSToIntRound(float f) { + /* return ((0.0f <= aValue) ? PRInt32(aValue + ROUND_CONST_FLOAT) : PRInt32(aValue - ROUND_CONST_FLOAT)); + */ + float fi; + int a[2]; + f *= (float) 1.000001; + asm("fctiw %0,%1" : "=f" (fi) : "f" (f)); + asm("stfd %1,%0" : "=m" (a) : "f" (fi)); + return a[1]; } inline PRInt32 NSToIntRoundExclusive(float aValue)