Created
November 5, 2013 15:51
-
-
Save markpapadakis/7321148 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| // Useful for sorting things - e.g TrivialCmp<int>(a, b) | |
| template<typename T> | |
| inline int32_t TrivialCmp(const T a, const T b) | |
| { | |
| if (a < b) | |
| return -1; | |
| else if (a > b) | |
| return 1; | |
| else | |
| return 0; | |
| } | |
| // For passing strings back and forth | |
| // You may also want to define e.g strwithlen8_t, strwithlen16_t (where size denotes type of length) | |
| // as a standard way to reference strings with length | |
| #define STRLEN(p) (sizeof(p)-1) | |
| #define STRWITHLEN(p) (p), (sizeof(p)-1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment