forked from ovr/StaticScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdynamic.h
More file actions
47 lines (38 loc) · 798 Bytes
/
dynamic.h
File metadata and controls
47 lines (38 loc) · 798 Bytes
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
44
45
46
47
//
// Created by Dmitry Patsura on 2019-01-03.
//
#ifndef HLVM_RUNTIME_DYNAMIC_H
#define HLVM_RUNTIME_DYNAMIC_H
#include <cstdint>
enum DynamicType: int8_t {
BOOLEAN = 1,
NUMBER = 2,
INT64 = 3,
UNDEFINED = 3,
};
class Dynamic {
public:
Dynamic(double value) {
this->number = value;
this->type = DynamicType::NUMBER;
}
Dynamic(bool value) {
this->boolean = value;
this->type = DynamicType::BOOLEAN;
}
Dynamic(int64_t value) {
this->int64 = value;
this->type = DynamicType::INT64;
}
Dynamic() {
this->type = DynamicType::UNDEFINED;
}
private:
DynamicType type;
union {
double number;
bool boolean;
int64_t int64;
};
};
#endif //HLVM_RUNTIME_DYNAMIC_H