third_party/pixman/pixman/pixman-matrix.c
static inline int64_t
rounded_sdiv_128_by_49 (int64_t   hi,
                        uint64_t  lo,
                        int64_t   div,
                        int64_t  *signed_result_hi)
{
    uint64_t result_lo, result_hi;
    int sign = 0;
    if (div < 0)
    {
        div = -div;
        sign ^= 1;
    }
    if (hi < 0)
    {
        if (lo != 0)
            hi++;
        hi = -hi;
        lo = -lo;
        sign ^= 1;
    }
    result_lo = rounded_udiv_128_by_48 (hi, lo, div, &result_hi);
    if (sign)
    {
        if (result_lo != 0)
            result_hi++;
        result_hi = -result_hi;
        result_lo = -result_lo;
    }
    if (signed_result_hi)
    {
        *signed_result_hi = result_hi;
    }
    return result_lo;
}
/* signed division (128-bit by 49-bit) with rounding to nearest */
signed division (128-bit by 49-bit) with rounding to nearest
signed division ( 128 - bit by 49 - bit ) with rounding to nearest
static inline int64_t
rounded_sdiv_128_by_49 (int64_t   hi,
                        uint64_t  lo,
                        int64_t   div,
                        int64_t  *signed_result_hi)
{
    uint64_t result_lo, result_hi;
    int sign = 0;
    if (div < 0)
    {
        div = -div;
        sign ^= 1;
    }
    if (hi < 0)
    {
        if (lo != 0)
            hi++;
        hi = -hi;
        lo = -lo;
        sign ^= 1;
    }
    result_lo = rounded_udiv_128_by_48 (hi, lo, div, &result_hi);
    if (sign)
    {
        if (result_lo != 0)
            result_hi++;
        result_hi = -result_hi;
        result_lo = -result_lo;
    }
    if (signed_result_hi)
    {
        *signed_result_hi = result_hi;
    }
    return result_lo;
}
static inline int64_t rounded_sdiv_128_by_49 ( int64_t hi , uint64_t lo , int64_t div , int64_t * signed_result_hi ) { uint64_t result_lo , result_hi ; int sign = 0 ; if ( div < 0 ) { div = - div ; sign ^= 1 ; } if ( hi < 0 ) { if ( lo != 0 ) hi ++ ; hi = - hi ; lo = - lo ; sign ^= 1 ; } result_lo = rounded_udiv_128_by_48 ( hi , lo , div , & result_hi ) ; if ( sign ) { if ( result_lo != 0 ) result_hi ++ ; result_hi = - result_hi ; result_lo = - result_lo ; } if ( signed_result_hi ) { * signed_result_hi = result_hi ; } return result_lo ; }
signed division (128-bit by 49-bit) with rounding to nearest
signed division ( 128 - bit by 49 - bit ) with rounding to nearest