Created
January 5, 2014 17:10
-
-
Save alvaromuir/8270884 to your computer and use it in GitHub Desktop.
Some common Objective-C Macros
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
#define PI 3.141592654 | |
#define TWO_PI 2.0 * PI | |
#define SQUARE(x) ((x)*(x)) | |
#define CUBE(x) ((x)*(x)*(x)) | |
#define IS_LEAP_YEAR(y) y % 4 == 0 && y % 100 != 0 || y % 400 == 0 | |
#define IS_LOWER_CASE(x) ( ((x) >= 'a') && ((x) <= 'z')) | |
#define TO_UPPER(x) (IS_LOWER_CASE(x) ? (x) - 'a' + 'A': (x)) | |
#define INCHES_PER_CENT 0.394 | |
#define CENT_PER_INCH (1/INCHES_PER_CENT) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment