aboutsummaryrefslogtreecommitdiff
path: root/include/type.h
blob: d871106885bcf2427438f3e28a52c8ff84ab828f (plain) (blame)
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
41
42
43
#ifndef CERC_TYPE_H
#define CERC_TYPE_H
#include <stdbool.h>
#include <stdint.h>
#include "expr.h"
#include "lex.h"
#include "util.h"

// Only 64-bit targets are supported
#define PLATBITS 64

struct cer_int {
	int bits;
	int issigned;
};

struct cer_float {
	int bits;
};

enum typekind {
	TK_INT,
	TK_FLOAT,
	TK_BOOL,
};

struct type {
	enum typekind kind;
	union {
		struct cer_int i;
		struct cer_float fp;
	} desc;
};

extern const struct cer_int cer_int8_t, cer_uint8_t;
extern const struct cer_int cer_int16_t, cer_uint16_t;
extern const struct cer_int cer_int32_t, cer_uint32_t;
extern const struct cer_int cer_int64_t, cer_uint64_t;
extern const struct cer_int cer_int_t, cer_uint_t;
extern const struct cer_float cer_float32_t;
extern const struct cer_float cer_float64_t;

#endif