aboutsummaryrefslogtreecommitdiff
path: root/deps/libchdr/coretypes.h
blob: 6264bea67bbf94f3a4ec268deaa19184d195bc13 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef __CORETYPES_H__
#define __CORETYPES_H__

#include <stdint.h>
#include <stdio.h>

#ifdef __LIBRETRO__
#include <streams/file_stream_transforms.h>
#endif

#define ARRAY_LENGTH(x) (sizeof(x)/sizeof(x[0]))

typedef uint64_t UINT64;
typedef uint32_t UINT32;
typedef uint16_t UINT16;
typedef uint8_t UINT8;

typedef int64_t INT64;
typedef int32_t INT32;
typedef int16_t INT16;
typedef int8_t INT8;

#define core_file FILE
#define core_fopen(file) fopen(file, "rb")
#define core_fseek fseek
#define core_fread(fc, buff, len) fread(buff, 1, len, fc)
#define core_fclose fclose
#define core_ftell ftell

static size_t core_fsize(core_file* f)
{
   size_t rv;
   size_t p = ftell(f);
   fseek(f, 0, SEEK_END);
   rv = ftell(f);
   fseek(f, p, SEEK_SET);
   return rv;
}

#endif