Referring to Convert to absolute value in Objective-C I\'m wondering if there are functions for NS typedefed types. Or is abs(NSInteger) okay? Is it architecture-sa
abs(NSInteger)
You can use Foundation’s ABS() macro:
NSInteger a = 5; NSInteger b = -5; NSLog(@"%ld %ld", ABS(a), ABS(b));