From 4bde4893c9ab3a0d09570946b67734751bc84408 Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Tue, 4 Aug 2026 16:16:32 +0200 Subject: Pushing something --- modules/codec-unit/c++/unit_schema.hpp | 12 +++++++++--- modules/codec-unit/c++/unit_transform.hpp | 27 ++++++++++++++------------- 2 files changed, 23 insertions(+), 16 deletions(-) (limited to 'modules/codec-unit/c++') diff --git a/modules/codec-unit/c++/unit_schema.hpp b/modules/codec-unit/c++/unit_schema.hpp index 5de8770..a675e23 100644 --- a/modules/codec-unit/c++/unit_schema.hpp +++ b/modules/codec-unit/c++/unit_schema.hpp @@ -4,11 +4,17 @@ namespace saw { namespace schema { -template -struct UnitElement {}; +template +struct UnitElement { + using Schema = Un; + static constexpr int64_t Exponent = Expo; + static constexpr int64_t Scaling = Scal; +}; template -struct Unit {}; +struct Unit { + using Schema = BaseSchema; +}; template using Pure = Unit; diff --git a/modules/codec-unit/c++/unit_transform.hpp b/modules/codec-unit/c++/unit_transform.hpp index 5e90878..40a85a1 100644 --- a/modules/codec-unit/c++/unit_transform.hpp +++ b/modules/codec-unit/c++/unit_transform.hpp @@ -18,9 +18,9 @@ class unit_redux_list { using Type = unit_redux_list<>; }; -template -struct unit_redux_list, schema::UnitElement...> { - using Type = typename unit_matching, schema::UnitElement...>, unit_redux_list<>>::TypeList; +template +struct unit_redux_list, schema::UnitElement...> { + using Type = typename unit_matching, schema::UnitElement...>, unit_redux_list<>>::TypeList; }; template @@ -32,16 +32,16 @@ public: /** * Iterate over the left list to check against the left element. */ -template -class unit_matching_reduce, unit_redux_list,schema::UnitElement...>, unit_redux_list...>> { +template +class unit_matching_reduce, unit_redux_list,schema::UnitElement...>, unit_redux_list...>> { public: - static constexpr bool is_same = std::is_same_v; + static constexpr bool is_same = std::is_same_v and std::is_same_v; // Match T,E against T0,E0 - using ReducedType = typename std::conditional, schema::UnitElement>::type; - using ReducedTypeList = typename std::conditional...>, unit_redux_list..., schema::UnitElement>>::type; + using ReducedType = typename std::conditional, schema::UnitElement>::type; + using ReducedTypeList = typename std::conditional...>, unit_redux_list..., schema::UnitElement>>::type; - using NextMatcher = unit_matching_reduce...>, ReducedTypeList>; + using NextMatcher = unit_matching_reduce...>, ReducedTypeList>; using Type = typename NextMatcher::Type; using TypeList = typename NextMatcher::TypeList; static constexpr int64_t Num = NextMatcher::Num; @@ -51,12 +51,13 @@ public: * Final step after going through the list. This contains the final match result. * On the left is the accumulated type and on the right its's a list of non matching types */ -template -class unit_matching_reduce, unit_redux_list<>, unit_redux_list...>> { +template +class unit_matching_reduce, unit_redux_list<>, unit_redux_list...>> { public: - using Type = schema::UnitElement; - using TypeList = unit_redux_list...>; + using Type = schema::UnitElement; + using TypeList = unit_redux_list...>; static constexpr int64_t Num = E; + static constexpr int64_t Scale = S; }; template -- cgit v1.2.3