From 95645c9fe15a08ebbe93b39cc039580ca76f48ef Mon Sep 17 00:00:00 2001 From: CblPOK-git Date: Mon, 11 Sep 2023 20:35:57 +0000 Subject: [PATCH] add glue_non_native into basic_non_native_policy --- .../nil/blueprint/basic_non_native_policy.hpp | 32 ++++++++++++++++--- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/include/nil/blueprint/basic_non_native_policy.hpp b/include/nil/blueprint/basic_non_native_policy.hpp index 42657a0ae..c591880da 100644 --- a/include/nil/blueprint/basic_non_native_policy.hpp +++ b/include/nil/blueprint/basic_non_native_policy.hpp @@ -74,12 +74,24 @@ namespace nil { chopped_value_type result; for (std::size_t i = 0; i < ratio; i++) { result[i] = get_i_th_chunk(input, i); - } - return result; + } + static non_native_field_type::value_type glue_non_native(chopped_value_type input) { + non_native_field_type::value_type result; + native_field_type::integral_type integral_input; + result = non_native_field_type::value_type(native_field_type::integral_type(input[0].data)); + for (std::size_t i = 1; i < ratio; i++) { + std::size_t shift = 0; + for (std::size_t j = 0; j < i; j++) { + shift += chunk_sizes[j]; + } + result += non_native_field_type::value_type(native_field_type::integral_type(input[i].data) << shift); + } + return result; } + }; /* @@ -132,12 +144,24 @@ namespace nil { chopped_value_type result; for (std::size_t i = 0; i < ratio; i++) { result[i] = get_i_th_chunk(input, i); - } - return result; + } + static non_native_field_type::value_type glue_non_native(chopped_value_type input) { + non_native_field_type::value_type result; + native_field_type::integral_type integral_input; + result = non_native_field_type::value_type(native_field_type::integral_type(input[0].data)); + for (std::size_t i = 1; i < ratio; i++) { + std::size_t shift = 0; + for (std::size_t j = 0; j < i; j++) { + shift += chunk_sizes[j]; + } + result += non_native_field_type::value_type(native_field_type::integral_type(input[i].data) << shift); + } + return result; } + }; /*