/* format.h * ---------------------------------------------------------------------------- * 'THE BEER-WARE LICENSE' (Revision 42): * wrote this file. As long as you retain this notice * you can do whatever you want with this stuff. If we meet some day, and you * think this stuff is worth it, you can buy me a beer in return. * Benjamin Chausse * ---------------------------------------------------------------------------- */ #define TRUE 1 #define FALSE 0 #define COUNT_OF( arr) (sizeof(arr)/sizeof(0[arr])) // Conversion table between uppercase and lowercase const char caps[2][26] = { {'A','B','C','D','E','F','G','H','I','J','K','L','M', 'N','O','P','Q','R','S','T','U','V','W','X','Y','Z'}, {'a','b','c','d','e','f','g','h','i','j','k','l','m', 'n','o','p','q','r','s','t','u','v','w','x','y','z'} }; double pow(double b, int e){ if (e==1){ return b; } else if (e%2==0){ return pow(b*b,e/2); } else { return b * pow(b*b, e/2); } } // Convert every character to lowercase const char* lower(char *str){ int len = COUNT_OF(str); for (int i=0; i0) ? i : -i; }