diff options
author | Roland Reichwein <mail@reichwein.it> | 2020-11-06 18:20:34 +0100 |
---|---|---|
committer | Roland Reichwein <mail@reichwein.it> | 2020-11-06 18:20:34 +0100 |
commit | 71c7fd62f8b5257b82cf32b0f747fcf313fcc617 (patch) | |
tree | 6f014b14d08080459a04a965912c62605d9015ca /flowgraph/node.cpp | |
parent | 62aafc5c9273cb0b7a91bf2e4dee1ac2d3658bb3 (diff) |
Prepare Token/Node handling
Diffstat (limited to 'flowgraph/node.cpp')
-rw-r--r-- | flowgraph/node.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/flowgraph/node.cpp b/flowgraph/node.cpp index fc55ef6..f81a7e1 100644 --- a/flowgraph/node.cpp +++ b/flowgraph/node.cpp @@ -2,8 +2,25 @@ #include "data.h" +#include <boost/endian/conversion.hpp> + using namespace FlowGraph; -Data FlowGraph::MakeLocalPointer(const std::string& name) { return Data(DataType::Pointer, std::make_shared<LocalStorage>(name)); } -Data FlowGraph::MakeLocalSize(const std::string& name) { return Data(DataType::Size, std::make_shared<LocalStorage>(name)); } +// 4 byte for now +Data FlowGraph::MakeConstantInt(int i) +{ + std::vector<uint8_t> value(size_t(4)); + *(reinterpret_cast<int32_t*>(value.data())) = boost::endian::native_to_little(static_cast<int32_t>(i)); + return Data(DataType::Int, std::make_shared<Constant>(value)); +} + +Data FlowGraph::MakeLocalPointer(const std::string& name) +{ + return Data(DataType::Pointer, std::make_shared<LocalStorage>(name)); +} + +Data FlowGraph::MakeLocalSize(const std::string& name) +{ + return Data(DataType::Size, std::make_shared<LocalStorage>(name)); +} |