/****************************************************************************** * * Created by: Carla Negri Lintzmayer * Maycon Sambinelli * To be used by our students * * CC BY-NC-ND 4.0 * Attribution-NonCommercial-NoDerivatives 4.0 International * https://creativecommons.org/licenses/by-nc-nd/4.0/ * *****************************************************************************/ #ifndef __UTILS_H_ #define __UTILS_H_ #include #include #define DEBUGING 1 #define DEBUG(fmt, ...) \ do { if (DEBUGING) fprintf(stderr, "%s:%d:%s(): " fmt, __FILE__, \ __LINE__, __func__, __VA_ARGS__); } while (0) #define INIT_RAND do { srand((long) time(NULL)); } while (0) void* Malloc(size_t size); double rand_double(); int rand_int(int a, int b); /* a to b, inclusive */ typedef struct {double x; double y;} Point; Point point(double, double); #define SWAP(a, b) do { typeof(a) t; t = a; a = b; b = t; } while(0) #define MAX(a, b) (((a) > (b)) ? (a) : (b)) #define MIN(a, b) (((a) < (b)) ? (a) : (b)) #endif // __UTILS_H_