feat(furvm): add step function to executor
This commit is contained in:
+11
-1
@@ -10,7 +10,7 @@ namespace furvm {
|
||||
|
||||
std::size_t thing_type_size(thing_t type) {
|
||||
switch (type) {
|
||||
case thing_t::Int: return 4;
|
||||
case thing_t::Int32: return 4;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -28,6 +28,16 @@ thing_p thing::create(const context_p& context, thing_t type) {
|
||||
return std::move(th);
|
||||
}
|
||||
|
||||
std::int32_t& thing::int32() {
|
||||
if (m_type != thing_t::Int32) throw bad_thing_access();
|
||||
return *static_cast<std::int32_t*>(m_data);
|
||||
}
|
||||
|
||||
const std::int32_t& thing::int32() const {
|
||||
if (m_type != thing_t::Int32) throw bad_thing_access();
|
||||
return *static_cast<std::int32_t*>(m_data);
|
||||
}
|
||||
|
||||
} // namespace furvm
|
||||
|
||||
// NOLINTEND(cppcoreguidelines-no-malloc)
|
||||
Reference in New Issue
Block a user