You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ugui/text_rendering/util.h

35 lines
1.2 KiB

2 years ago
#ifndef _UTIL_H
#define _UTIL_H
#include <stdio.h>
2 years ago
2 years ago
void * emalloc(unsigned long int size);
void * ecalloc(unsigned long int nmemb, unsigned long int size);
void * erealloc(void *ptr, unsigned long int size);
2 years ago
void efree(void *ptr);
void map_file(const unsigned char **str, int *size, const char *path);
2 years ago
void dump_file(const char *path, char **buf, int *buf_len);
2 years ago
void print_byte(unsigned char byte);
2 years ago
void stopwatch_start(void);
double stopwatch_get(void);
#define TIME_SEC(f) \
{ \
stopwatch_start(); \
f; \
printf("\"%s\" took %f seconds", #f, stopwatch_get()); \
}
#define TIME_MS(f) \
{ \
stopwatch_start(); \
f; \
printf("\"%s\" took %f ms", #f, stopwatch_get()*1000.0f); \
}
2 years ago
#endif