File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -802,12 +802,12 @@ constexpr auto to_dpd_d128(DecimalType val) noexcept
802802 dpd.high |= (combination_field_bits << 58U );
803803 dpd.high |= (trailing_exp_bits << 46U );
804804
805- // Now we have to encode all 10 of the declets
806- int offset {9 };
805+ // Now we have to encode all 11 of the declets
806+ int offset {10 };
807807 for (std::size_t i {1 }; i < num_digits - 1 ; i += 3U )
808808 {
809809 const auto declet {static_cast <detail::uint128>(detail::encode_dpd (d[i], d[i + 1 ], d[i + 2 ]))};
810- dpd |= (declet << (10 * offset));
810+ dpd |= detail::uint128 (declet << (10 * offset));
811811 --offset;
812812 }
813813
@@ -892,7 +892,7 @@ constexpr auto from_dpd_d128(detail::uint128 dpd) noexcept
892892 detail::uint128 significand {};
893893 for (int i {}; i < num_digits; ++i)
894894 {
895- significand += static_cast <detail::uint128>(digits[i]) * detail::pow10 (static_cast <detail::uint128>(num_digits - i));
895+ significand += static_cast <detail::uint128>(digits[i]) * detail::pow10 (static_cast <detail::uint128>(( num_digits - 1 ) - i));
896896 }
897897
898898 return DecimalType{significand, exp, sign};
You can’t perform that action at this time.
0 commit comments