| 712 | } |
| 713 | |
| 714 | int64_t ToInt64(const BasicDecimalScalar128& in, bool* overflow) { |
| 715 | auto rounded = RoundWithPositiveScale(in, in.precision(), 0 /*scale*/, |
| 716 | RoundType::kRoundTypeHalfRoundUp, overflow); |
| 717 | DECIMAL_OVERFLOW_IF((rounded > std::numeric_limits<int64_t>::max()) || |
| 718 | (rounded < std::numeric_limits<int64_t>::min()), |
| 719 | overflow); |
| 720 | return static_cast<int64_t>(rounded.low_bits()); |
| 721 | } |
| 722 | |
| 723 | } // namespace decimalops |
| 724 | } // namespace gandiva |