Skip to content

Instantly share code, notes, and snippets.

@axelarge
Created November 9, 2013 15:36
Show Gist options
  • Save axelarge/7386644 to your computer and use it in GitHub Desktop.
Save axelarge/7386644 to your computer and use it in GitHub Desktop.
Objective-C NSComparisonResult for primitives macro
#define COMPARE(A, B) ({ \
__typeof__(A) __a = (A); \
__typeof__(B) __b = (B); \
__a < __b ? NSOrderedAscending : __a == __b ? NSOrderedSame : NSOrderedDescending; \
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment