Skip to content

Commit

Permalink
Bug 847480 - Convert DeprecatedAbs uses that can relatively obviously…
Browse files Browse the repository at this point in the history
… be changd to Abs, to Abs. r=Ms2ger
  • Loading branch information
jswalden committed Mar 5, 2013
1 parent f915a6c commit b30b419
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 17 deletions.
4 changes: 2 additions & 2 deletions content/canvas/src/CanvasRenderingContext2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3716,8 +3716,8 @@ CanvasRenderingContext2D::CreateImageData(JSContext* cx, double sw,
int32_t wi = JS_DoubleToInt32(sw);
int32_t hi = JS_DoubleToInt32(sh);

uint32_t w = DeprecatedAbs(wi);
uint32_t h = DeprecatedAbs(hi);
uint32_t w = Abs(wi);
uint32_t h = Abs(hi);
return mozilla::dom::CreateImageData(cx, this, w, h, error);
}

Expand Down
2 changes: 1 addition & 1 deletion gfx/layers/basic/BasicTiledThebesLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ BasicTiledThebesLayer::ComputeProgressiveUpdateRegion(BasicTiledLayerBuffer& aTi
if (!aRegionToPaint.IsEmpty()) {
break;
}
if (DeprecatedAbs(scrollDiffY) >= DeprecatedAbs(scrollDiffX)) {
if (Abs(scrollDiffY) >= Abs(scrollDiffX)) {
tileBounds.x += incX;
} else {
tileBounds.y += incY;
Expand Down
3 changes: 1 addition & 2 deletions js/src/ion/RangeAnalysis.h
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,7 @@ class Range : public TempObject {
return;
}

uint32_t max = Max(mozilla::DeprecatedAbs<int64_t>(lower()),
mozilla::DeprecatedAbs<int64_t>(upper()));
uint32_t max = Max(mozilla::Abs<int64_t>(lower()), mozilla::Abs<int64_t>(upper()));
JS_ASSERT_IF(lower() == JSVAL_INT_MIN, max == (uint32_t) JSVAL_INT_MIN);
JS_ASSERT(max <= (uint32_t) JSVAL_INT_MIN);
// The number of bits needed to encode |max| is the power of 2 plus one.
Expand Down
6 changes: 3 additions & 3 deletions js/src/ion/arm/MacroAssembler-arm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
using namespace js;
using namespace ion;

using mozilla::DeprecatedAbs;
using mozilla::Abs;

bool
isValueDTRDCandidate(ValueOperand &val)
Expand Down Expand Up @@ -2526,7 +2526,7 @@ MacroAssemblerARMCompat::storeValue(ValueOperand val, Operand dst) {
void
MacroAssemblerARMCompat::storeValue(ValueOperand val, const BaseIndex &dest)
{
if (isValueDTRDCandidate(val) && DeprecatedAbs(dest.offset) <= 255) {
if (isValueDTRDCandidate(val) && Abs(dest.offset) <= 255) {
Register tmpIdx;
if (dest.offset == 0) {
if (dest.scale == TimesOne) {
Expand All @@ -2550,7 +2550,7 @@ MacroAssemblerARMCompat::storeValue(ValueOperand val, const BaseIndex &dest)
void
MacroAssemblerARMCompat::loadValue(const BaseIndex &addr, ValueOperand val)
{
if (isValueDTRDCandidate(val) && DeprecatedAbs(addr.offset) <= 255) {
if (isValueDTRDCandidate(val) && Abs(addr.offset) <= 255) {
Register tmpIdx;
if (addr.offset == 0) {
if (addr.scale == TimesOne) {
Expand Down
4 changes: 2 additions & 2 deletions js/src/methodjit/FastArithmetic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ using namespace js::mjit;
using namespace js::analyze;
using namespace JSC;

using mozilla::DeprecatedAbs;
using mozilla::Abs;

typedef JSC::MacroAssembler::FPRegisterID FPRegisterID;

Expand Down Expand Up @@ -333,7 +333,7 @@ mjit::Compiler::jsop_binary_double(FrameEntry *lhs, FrameEntry *rhs, JSOp op,
(type == JSVAL_TYPE_INT32 ||
(type == JSVAL_TYPE_UNKNOWN &&
!(lhs->isConstant() && lhs->isType(JSVAL_TYPE_INT32) &&
DeprecatedAbs(lhs->getValue().toInt32()) == 1))))
Abs(lhs->getValue().toInt32()) == 1))))
{
RegisterID reg = frame.allocReg();
FPRegisterID fpReg = frame.allocFPReg();
Expand Down
8 changes: 4 additions & 4 deletions widget/gtk2/nsNativeKeyBindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ delete_from_cursor_cb(GtkWidget *w, GtkDeleteType del_type,
if (!cmd)
return; // unsupported command

count = DeprecatedAbs(count);
for (int i = 0; i < count; ++i) {
unsigned int absCount = Abs(count);
for (unsigned int i = 0; i < absCount; ++i) {
gCurrentCallback(cmd, gCurrentCallbackData);
}
}
Expand Down Expand Up @@ -169,8 +169,8 @@ move_cursor_cb(GtkWidget *w, GtkMovementStep step, gint count,
return; // unsupported command


count = DeprecatedAbs(count);
for (int i = 0; i < count; ++i) {
unsigned int absCount = Abs(count);
for (unsigned int i = 0; i < absCount; ++i) {
gCurrentCallback(cmd, gCurrentCallbackData);
}
}
Expand Down
2 changes: 1 addition & 1 deletion widget/nsGUIEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -1344,7 +1344,7 @@ class WheelEvent : public nsMouseEvent_base
(lineOrPageDeltaX > 0 && lineOrPageDeltaY < 0)) {
return 0; // We cannot guess the answer in this case.
}
return (DeprecatedAbs(lineOrPageDeltaX) > DeprecatedAbs(lineOrPageDeltaY)) ?
return (Abs(lineOrPageDeltaX) > Abs(lineOrPageDeltaY)) ?
lineOrPageDeltaX : lineOrPageDeltaY;
}

Expand Down
4 changes: 2 additions & 2 deletions xpfe/appshell/src/nsXULWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1270,7 +1270,7 @@ void nsXULWindow::StaggerPosition(int32_t &aRequestedX, int32_t &aRequestedY,
int32_t aSpecWidth, int32_t aSpecHeight)
{
const int32_t kOffset = 22;
const int32_t kSlop = 4;
const uint32_t kSlop = 4;

nsresult rv;
bool keepTrying;
Expand Down Expand Up @@ -1349,7 +1349,7 @@ void nsXULWindow::StaggerPosition(int32_t &aRequestedX, int32_t &aRequestedY,
listY = NSToIntRound(listY / scale);
}

if (DeprecatedAbs(listX - aRequestedX) <= kSlop && DeprecatedAbs(listY - aRequestedY) <= kSlop) {
if (Abs(listX - aRequestedX) <= kSlop && Abs(listY - aRequestedY) <= kSlop) {
// collision! offset and start over
if (bouncedX & 0x1)
aRequestedX -= kOffset;
Expand Down

0 comments on commit b30b419

Please sign in to comment.