diff options
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)); +} |