| 134 | struct ShiftRight { |
| 135 | template <typename T, typename Arg0, typename Arg1> |
| 136 | static T Call(KernelContext*, Arg0 lhs, Arg1 rhs, Status*) { |
| 137 | static_assert(std::is_same<T, Arg0>::value, ""); |
| 138 | // Logical right shift when Arg0 is unsigned |
| 139 | // Arithmetic otherwise (this is implementation-defined but GCC and MSVC document this |
| 140 | // as arithmetic right shift) |
| 141 | // https://gcc.gnu.org/onlinedocs/gcc/Integers-implementation.html#Integers-implementation |
| 142 | // https://docs.microsoft.com/en-us/cpp/cpp/left-shift-and-right-shift-operators-input-and-output?view=msvc-160 |
| 143 | // Clang doesn't document their behavior. |
| 144 | if (ARROW_PREDICT_FALSE(rhs < 0 || rhs >= std::numeric_limits<Arg0>::digits)) { |
| 145 | return lhs; |
| 146 | } |
| 147 | return lhs >> rhs; |
| 148 | } |
| 149 | }; |
| 150 | |
| 151 | struct ShiftRightChecked { |
nothing calls this directly
no outgoing calls
no test coverage detected