Skip to content

Commit

Permalink
Fix non native field type conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
akokoshn committed Jun 21, 2024
1 parent 5cdecf0 commit 9d9389e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion include/nil/blueprint/non_native_marshalling.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,14 @@ namespace nil {
else {
if constexpr (non_native_policy::ratio == 1) {
column_type<BlueprintFieldType> res;
res.push_back(typename BlueprintFieldType::value_type(typename BlueprintFieldType::integral_type(input.data)));
typename BlueprintFieldType::integral_type chopped_val = typename BlueprintFieldType::integral_type::backend_type(input.data.backend().base_data());
if (NonNativeFieldType::modulus_bits < BlueprintFieldType::modulus_bits) {
// set unused bits 0
typename BlueprintFieldType::integral_type base = 1;
typename BlueprintFieldType::integral_type mask = (base << NonNativeFieldType::modulus_bits) - 1;
chopped_val = chopped_val & mask;
}
res.push_back(typename BlueprintFieldType::value_type(chopped_val));
return res;
}
else {
Expand Down

0 comments on commit 9d9389e

Please sign in to comment.