| 134 | } |
| 135 | |
| 136 | static BasicDecimal128 AddLarge(const BasicDecimalScalar128& x, |
| 137 | const BasicDecimalScalar128& y, int32_t out_scale) { |
| 138 | if (x.value() >= 0 && y.value() >= 0) { |
| 139 | // both positive or 0 |
| 140 | return AddLargePositive(x, y, out_scale); |
| 141 | } else if (x.value() <= 0 && y.value() <= 0) { |
| 142 | // both negative or 0 |
| 143 | BasicDecimalScalar128 x_neg(-x.value(), x.precision(), x.scale()); |
| 144 | BasicDecimalScalar128 y_neg(-y.value(), y.precision(), y.scale()); |
| 145 | return -AddLargePositive(x_neg, y_neg, out_scale); |
| 146 | } else { |
| 147 | // one positive and the other negative |
| 148 | return AddLargeNegative(x, y, out_scale); |
| 149 | } |
| 150 | } |
| 151 | |
| 152 | // Suppose we have a number that requires x bits to be represented and we scale it up by |
| 153 | // 10^scale_by. Let's say now y bits are required to represent it. This function returns |
no test coverage detected