Compute the integer absolute value (abs) without branching | GeeksforGeeks unsigned int getAbs(int n...

Please Visit: http://ift.tt/1ajReyV



Compute the integer absolute value (abs) without branching | GeeksforGeeks

unsigned int getAbs(int n){ int const mask = n >> (sizeof(int) * CHAR_BIT - 1); return ((n + mask) ^ mask);}

http://ift.tt/1iegKzX

http://ift.tt/1iegIIk



Compute the integer absolute value (abs) without branching | GeeksforGeeks







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1lNLNNU

via LifeLong Community

No comments:

Post a Comment