tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit e45ad81c34f3f4fb8eeebbc7483543d3791f92c3
parent 8e6fd7cd1fb98ea9b46be370f984715b5f1fc961
Author: Emilio Cobos Álvarez <emilio@crisal.io>
Date:   Fri, 21 Nov 2025 20:25:41 +0000

Bug 2001591 - Remove NS_lroundup30. r=xpcom-reviewers,layout-reviewers,mccr8,tnikkel

It got disabled on clang-cl and that's the only thing we've been
shipping for a while.

Differential Revision: https://phabricator.services.mozilla.com/D273558

Diffstat:
Mgfx/src/nsCoord.h | 10----------
Mxpcom/ds/nsMathUtils.h | 36------------------------------------
2 files changed, 0 insertions(+), 46 deletions(-)

diff --git a/gfx/src/nsCoord.h b/gfx/src/nsCoord.h @@ -98,21 +98,11 @@ inline nscoord NSCoordMulDiv(nscoord aMult1, nscoord aMult2, nscoord aDiv) { } inline nscoord NSToCoordRound(float aValue) { -#if defined(XP_WIN) && defined(_M_IX86) && !defined(__GNUC__) && \ - !defined(__clang__) - return NS_lroundup30(aValue); -#else return nscoord(floorf(aValue + 0.5f)); -#endif /* XP_WIN && _M_IX86 && !__GNUC__ */ } inline nscoord NSToCoordRound(double aValue) { -#if defined(XP_WIN) && defined(_M_IX86) && !defined(__GNUC__) && \ - !defined(__clang__) - return NS_lroundup30((float)aValue); -#else return nscoord(floor(aValue + 0.5f)); -#endif /* XP_WIN && _M_IX86 && !__GNUC__ */ } inline nscoord NSToCoordRoundWithClamp(float aValue) { diff --git a/xpcom/ds/nsMathUtils.h b/xpcom/ds/nsMathUtils.h @@ -28,42 +28,6 @@ inline int32_t NS_lround(double aNum) { return aNum >= 0.0 ? int32_t(aNum + 0.5) : int32_t(aNum - 0.5); } -/* NS_roundup30 rounds towards infinity for positive and */ -/* negative numbers. */ - -#if defined(XP_WIN) && defined(_M_IX86) && !defined(__GNUC__) && \ - !defined(__clang__) -inline int32_t NS_lroundup30(float x) { - /* Code derived from Laurent de Soras' paper at */ - /* http://ldesoras.free.fr/doc/articles/rounding_en.pdf */ - - /* Rounding up on Windows is expensive using the float to */ - /* int conversion and the floor function. A faster */ - /* approach is to use f87 rounding while assuming the */ - /* default rounding mode of rounding to the nearest */ - /* integer. This rounding mode, however, actually rounds */ - /* to the nearest integer so we add the floating point */ - /* number to itself and add our rounding factor before */ - /* doing the conversion to an integer. We then do a right */ - /* shift of one bit on the integer to divide by two. */ - - /* This routine doesn't handle numbers larger in magnitude */ - /* than 2^30 but this is fine for NSToCoordRound because */ - /* Coords are limited to 2^30 in magnitude. */ - - static const double round_to_nearest = 0.5f; - int i; - - __asm { - fld x ; load fp argument - fadd st, st(0) ; double it - fadd round_to_nearest ; add the rounding factor - fistp dword ptr i ; convert the result to int - } - return i >> 1; /* divide by 2 */ -} -#endif /* XP_WIN && _M_IX86 && !__GNUC__ */ - inline int32_t NS_lroundf(float aNum) { return aNum >= 0.0f ? int32_t(aNum + 0.5f) : int32_t(aNum - 0.5f); }