use std::abs instead

This commit is contained in:
minggo 2016-07-11 12:01:09 +08:00
parent 6248480b3a
commit 3dc167a9f9
3 changed files with 6 additions and 6 deletions

View File

@ -200,8 +200,8 @@ void SpriteFrameCache::addSpriteFramesWithDictionary(ValueMap& dictionary, Textu
CCLOGWARN("cocos2d: WARNING: originalWidth/Height not found on the SpriteFrame. AnchorPoint won't work as expected. Regenerate the .plist"); CCLOGWARN("cocos2d: WARNING: originalWidth/Height not found on the SpriteFrame. AnchorPoint won't work as expected. Regenerate the .plist");
} }
// abs ow/oh // abs ow/oh
ow = abs(ow); ow = std::abs(ow);
oh = abs(oh); oh = std::abs(oh);
// create frame // create frame
spriteFrame = SpriteFrame::createWithTexture(texture, spriteFrame = SpriteFrame::createWithTexture(texture,
Rect(x, y, w, h), Rect(x, y, w, h),
@ -635,8 +635,8 @@ void SpriteFrameCache::reloadSpriteFramesWithDictionary(ValueMap& dictionary, Te
CCLOGWARN("cocos2d: WARNING: originalWidth/Height not found on the SpriteFrame. AnchorPoint won't work as expected. Regenrate the .plist"); CCLOGWARN("cocos2d: WARNING: originalWidth/Height not found on the SpriteFrame. AnchorPoint won't work as expected. Regenrate the .plist");
} }
// abs ow/oh // abs ow/oh
ow = abs(ow); ow = std::abs(ow);
oh = abs(oh); oh = std::abs(oh);
// create frame // create frame
spriteFrame = SpriteFrame::createWithTexture(texture, spriteFrame = SpriteFrame::createWithTexture(texture,
Rect(x, y, w, h), Rect(x, y, w, h),

View File

@ -390,7 +390,7 @@ void TextureAtlas::insertQuadFromIndex(ssize_t oldIndex, ssize_t newIndex)
return; return;
} }
// because it is ambiguous in iphone, so we implement abs ourselves // because it is ambiguous in iphone, so we implement abs ourselves
// unsigned int howMany = abs( oldIndex - newIndex); // unsigned int howMany = std::abs( oldIndex - newIndex);
auto howMany = (oldIndex - newIndex) > 0 ? (oldIndex - newIndex) : (newIndex - oldIndex); auto howMany = (oldIndex - newIndex) > 0 ? (oldIndex - newIndex) : (newIndex - oldIndex);
auto dst = oldIndex; auto dst = oldIndex;
auto src = oldIndex + 1; auto src = oldIndex + 1;

View File

@ -72,7 +72,7 @@ extern int lua_isusertype (lua_State* L, int lo, const char* type);
bool luaval_is_usertype(lua_State* L,int lo,const char* type, int def) bool luaval_is_usertype(lua_State* L,int lo,const char* type, int def)
{ {
if (def && lua_gettop(L)<abs(lo)) if (def && lua_gettop(L)<std::abs(lo))
return true; return true;
if (lua_isnil(L,lo) || lua_isusertype(L,lo,type)) if (lua_isnil(L,lo) || lua_isusertype(L,lo,type))