Skip to main content

rb_cmpint

Function rb_cmpint 

Source
pub unsafe extern "C" fn rb_cmpint(
    val: VALUE,
    a: VALUE,
    b: VALUE,
) -> c_int
Expand description

Canonicalises the passed val, which is the return value of a <=> b, into C’s {-1, 0, 1}. This can be handy when you implement a callback function to pass to qsort(3) etc.

§@param[in] val Return value of a space ship operator. @param[in] a Comparison LHS. @param[in] b Comparison RHS. @exception rb_eArgError a and b are not comparable each other. @retval -1 val is less than zero. @retval 0 val is equal to zero. @retval 1 val is greater than zero.

Generated by rb-sys for Ruby mri-x86_64-linux-gnu-3.3.8