Bug 1317588 Part 5 - Change Side's operator++ from postfix to prefix.
The postfix operator++ was actually incorrectly implemented as a prefix
version. Since it's only used in NS_FOR_CSS_SIDES, let's changed it to
prefix version and gain some performance improvement.
MozReview-Commit-ID: 6p4yv5Nylqj
--- a/gfx/2d/Types.h
+++ b/gfx/2d/Types.h
@@ -402,20 +402,19 @@ enum SideBits {
eSideBitsLeftRight = eSideBitsLeft | eSideBitsRight,
eSideBitsAll = eSideBitsTopBottom | eSideBitsLeftRight
};
// Creates a for loop that walks over the first four mozilla::Side values.
#define NS_FOR_CSS_SIDES(var_) \
for (mozilla::Side var_ = mozilla::eSideTop; \
var_ <= mozilla::eSideLeft; \
- var_++)
+ ++var_)
-static inline Side operator++(Side& side, int) {
+static inline Side& operator++(Side& side) {
MOZ_ASSERT(side >= mozilla::eSideTop && side <= mozilla::eSideLeft,
"Out of range side");
- side = Side(side + 1);
- return side;
+ return ++side;
}
} // namespace mozilla
#endif /* MOZILLA_GFX_TYPES_H_ */