Created
October 8, 2012 23:00
-
-
Save JensAyton/3855499 to your computer and use it in GitHub Desktop.
Some of the macros in NSObjCRuntime.h just aren’t ugly enough.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#undef MIN | |
#define MIN__(A,B,C) ({ __typeof__(A) __a##C = (A); __typeof__(B) __b##C = (B); __a##C < __b##C ? __a##C : __b##C; }) | |
#define MIN_(A,B,C) MIN__(A,B,C) | |
#define MIN(A,B) MIN_(A,B,__COUNTER__) | |
#undef MAX | |
#define MAX__(A,B,C) ({ __typeof__(A) __a##C = (A); __typeof__(B) __b##C = (B); __a##C < __b##C ? __b##C : __a##C; }) | |
#define MAX_(A,B,C) MAX__(A,B,C) | |
#define MAX(A,B) MAX_(A,B,__COUNTER__) | |
#undef ABS | |
#define ABS__(A,C) ({ __typeof__(A) __a##C = (A); __a##C < 0 ? -__a##C : __a##C; }) | |
#define ABS_(A,C) ABS__(A,C) | |
#define ABS(A) ABS_(A,__COUNTER__) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment