From 601113a445658d8b15273dd91c66cf20daf50d30 Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Thu, 20 Jun 2024 16:35:25 +0200 Subject: Changing towards a better allocated structure for sycl --- modules/codec/c++/data.hpp | 8 ++++---- modules/codec/c++/interface.hpp | 19 +++++-------------- 2 files changed, 9 insertions(+), 18 deletions(-) (limited to 'modules/codec/c++') diff --git a/modules/codec/c++/data.hpp b/modules/codec/c++/data.hpp index 8e0e029..5ebe579 100644 --- a/modules/codec/c++/data.hpp +++ b/modules/codec/c++/data.hpp @@ -176,21 +176,21 @@ public: } data operator*(const data& rhs) const { - using CalcType = typename native_data_type::type; + using CalcType = typename native_data_type::type; CalcType left = static_cast(value_.get()); CalcType right = static_cast(rhs.get()); return {left * right}; } data operator/(const data& rhs)const{ - using CalcType = typename native_data_type::type; + using CalcType = typename native_data_type::type; CalcType left = static_cast(value_.get()); CalcType right = static_cast(rhs.get()); return {left / right}; } data operator+(const data& rhs)const{ - using CalcType = typename native_data_type::type; + using CalcType = typename native_data_type::type; CalcType left = static_cast(value_.get()); CalcType right = static_cast(rhs.get()); return {left + right}; @@ -202,7 +202,7 @@ public: } data operator-(const data& rhs)const{ - using CalcType = typename native_data_type::type; + using CalcType = typename native_data_type::type; CalcType left = static_cast(value_.get()); CalcType right = static_cast(rhs.get()); return {left - right}; diff --git a/modules/codec/c++/interface.hpp b/modules/codec/c++/interface.hpp index 0186f09..0f41f55 100644 --- a/modules/codec/c++/interface.hpp +++ b/modules/codec/c++/interface.hpp @@ -14,12 +14,12 @@ class function; namespace impl { template struct FuncTypeHelper { - using Type = std::function(data, Ctx)>; + using Type = std::function(data&, Ctx)>; }; template struct FuncTypeHelper { - using Type = std::function(data)>; + using Type = std::function(data&)>; }; } @@ -41,15 +41,6 @@ public: return func_(req, ctx); } } - - error_or> call(data&& req, Context ctx = {}){ - if constexpr (std::is_same_v){ - (void) ctx; - return func_(std::move(req)); - } else { - return func_(std::move(req), ctx); - } - } }; template @@ -106,14 +97,14 @@ public: Lit, Names... >::value , Requests...>::type - , Encode, Storage> req, + , Encode, Storage>& req, Context ctx = {} ){ if constexpr (std::is_same_v) { (void) ctx; - return get().call(std::move(req)); + return get().call(req); }else{ - return get().call(std::move(req), ctx); + return get().call(req, ctx); } } }; -- cgit v1.2.3