| 1 | #ifndef __CORETYPES_H__ |
| 2 | #define __CORETYPES_H__ |
| 3 | |
| 4 | #include <stdint.h> |
| 5 | #include <stdio.h> |
| 6 | |
| 7 | #define ARRAY_LENGTH(x) (sizeof(x)/sizeof(x[0])) |
| 8 | |
| 9 | typedef uint64_t UINT64; |
| 10 | typedef uint32_t UINT32; |
| 11 | typedef uint16_t UINT16; |
| 12 | typedef uint8_t UINT8; |
| 13 | |
| 14 | typedef int64_t INT64; |
| 15 | typedef int32_t INT32; |
| 16 | typedef int16_t INT16; |
| 17 | typedef int8_t INT8; |
| 18 | |
| 19 | #define core_file FILE |
| 20 | #define core_fopen(file) fopen(file, "rb") |
| 21 | #define core_fseek fseek |
| 22 | #define core_fread(fc, buff, len) fread(buff, 1, len, fc) |
| 23 | #define core_fclose fclose |
| 24 | #define core_ftell ftell |
| 25 | static size_t core_fsize(core_file *f) |
| 26 | { |
| 27 | long p = ftell(f); |
| 28 | fseek(f, 0, SEEK_END); |
| 29 | long rv = ftell(f); |
| 30 | fseek(f, p, SEEK_SET); |
| 31 | return rv; |
| 32 | } |
| 33 | |
| 34 | #endif |