File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,6 +18,8 @@ set(SOURCE_FILES
1818 machine.h
1919 array.cpp
2020 array.h
21+ dynamic.cpp
22+ dynamic.h
2123 v8/src/base/platform/mutex.cc
2224 v8/src/base/platform/time.cc
2325 v8/src/base/platform/semaphore.cc
@@ -55,7 +57,7 @@ if (LINUX)
5557 SOURCE_FILES
5658 ${SOURCE_FILES}
5759 v8/src/base/platform/platform-linux .cc
58- )
60+ dynamic.cpp dynamic.h )
5961endif ()
6062
6163add_library (hlvm-runtime STATIC ${SOURCE_FILES} )
Original file line number Diff line number Diff line change 1+ //
2+ // Created by Dmitry Patsura on 2019-01-03.
3+ //
4+
5+ #include " dynamic.h"
Original file line number Diff line number Diff line change 1+ //
2+ // Created by Dmitry Patsura on 2019-01-03.
3+ //
4+
5+ #ifndef HLVM_RUNTIME_DYNAMIC_H
6+ #define HLVM_RUNTIME_DYNAMIC_H
7+
8+ #include < cstdint>
9+
10+ enum DynamicType: int8_t {
11+ BOOLEAN_TYPE = 1 ,
12+ DOUBLE_TYPE = 2 ,
13+ };
14+
15+ class Dynamic {
16+ public:
17+ Dynamic (double value) {
18+ this ->d = value;
19+ this ->type = DynamicType::DOUBLE_TYPE;
20+ }
21+
22+ Dynamic (bool value) {
23+ this ->b = value;
24+ this ->type = DynamicType::BOOLEAN_TYPE;
25+ }
26+
27+ void setValue (double value) {
28+ this ->d = value;
29+ this ->type = DynamicType::DOUBLE_TYPE;
30+ };
31+
32+ void setValue (bool value) {
33+ this ->b = value;
34+ this ->type = DynamicType::BOOLEAN_TYPE;
35+ };
36+ private:
37+ DynamicType type;
38+
39+ union {
40+ double d;
41+ bool b;
42+ };
43+ };
44+
45+ #endif // HLVM_RUNTIME_DYNAMIC_H
You can’t perform that action at this time.
0 commit comments