Created
June 10, 2019 20:06
-
-
Save nhasbun/ae36faad9663a744ec9bbfee438e5627 to your computer and use it in GitHub Desktop.
Collection of useful 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 BIT(x,n) (((x) >> (n)) & 1) | |
#define INSERT_BITS(original, mask, value, num) (original & (~mask)) | (value << num) | |
#ifdef __ASSEMBLY__ | |
#define CAST(type, value) value | |
#else | |
#define CAST(type, value) ((type)(value)) | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment