Skip to main content

scalar_divisor

Function scalar_divisor 

Source
fn scalar_divisor<T: DecimalType>(
    l_s: bool,
    r: &PrimitiveArray<T>,
    r_s: bool,
    r_mul: T::Native,
) -> Option<T::Native>
where T::Native: CheckedMul,
Expand description

Returns the scalar divisor r scaled by r_mul, when l is an array and dividing any value by it can’t fail. That needs r to be valid and the product to fit and be neither 0 nor -1.

The kernel then needs no per-value checks of the divisor, which keeps the closure small enough for LLVM to inline into the loop of try_unary. Otherwise it returns None, and the kernel takes the general path, which reports any errors.