Rev 1892 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1892 | Rev 3959 | ||
---|---|---|---|
Line 82... | Line 82... | ||
82 | } |
82 | } |
Line 83... | Line 83... | ||
83 | 83 | ||
Line 84... | Line 84... | ||
84 | static const cairo_uint64_t uint64_carry32 = { 0, 1 }; |
84 | static const cairo_uint64_t uint64_carry32 = { 0, 1 }; |
- | 85 | ||
- | 86 | cairo_uint64_t |
|
- | 87 | _cairo_double_to_uint64 (double i) |
|
- | 88 | { |
|
- | 89 | cairo_uint64_t q; |
|
- | 90 | ||
- | 91 | q.hi = i * (1. / 4294967296.); |
|
- | 92 | q.lo = i - q.hi * 4294967296.; |
|
- | 93 | return q; |
|
- | 94 | } |
|
- | 95 | ||
- | 96 | double |
|
- | 97 | _cairo_uint64_to_double (cairo_uint64_t i) |
|
- | 98 | { |
|
- | 99 | return i.hi * 4294967296. + i.lo; |
|
- | 100 | } |
|
- | 101 | ||
- | 102 | cairo_int64_t |
|
- | 103 | _cairo_double_to_int64 (double i) |
|
- | 104 | { |
|
- | 105 | cairo_uint64_t q; |
|
- | 106 | ||
- | 107 | q.hi = i * (1. / INT32_MAX); |
|
- | 108 | q.lo = i - q.hi * (double)INT32_MAX; |
|
- | 109 | return q; |
|
- | 110 | } |
|
- | 111 | ||
- | 112 | double |
|
- | 113 | _cairo_int64_to_double (cairo_int64_t i) |
|
- | 114 | { |
|
- | 115 | return i.hi * INT32_MAX + i.lo; |
|
- | 116 | } |
|
85 | 117 | ||
86 | cairo_uint64_t |
118 | cairo_uint64_t |
87 | _cairo_uint32_to_uint64 (uint32_t i) |
119 | _cairo_uint32_to_uint64 (uint32_t i) |
Line 88... | Line 120... | ||
88 | { |
120 | { |
Line 670... | Line 702... | ||
670 | * Compute a 32 bit quotient and 64 bit remainder of a 96 bit unsigned |
702 | * Compute a 32 bit quotient and 64 bit remainder of a 96 bit unsigned |
671 | * dividend and 64 bit divisor. If the quotient doesn't fit into 32 |
703 | * dividend and 64 bit divisor. If the quotient doesn't fit into 32 |
672 | * bits then the returned remainder is equal to the divisor, and the |
704 | * bits then the returned remainder is equal to the divisor, and the |
673 | * quotient is the largest representable 64 bit integer. It is an |
705 | * quotient is the largest representable 64 bit integer. It is an |
674 | * error to call this function with the high 32 bits of @num being |
706 | * error to call this function with the high 32 bits of @num being |
675 | * non-zero. */ |
707 | * non-zero. |
- | 708 | **/ |
|
676 | cairo_uquorem64_t |
709 | cairo_uquorem64_t |
677 | _cairo_uint_96by64_32x64_divrem (cairo_uint128_t num, |
710 | _cairo_uint_96by64_32x64_divrem (cairo_uint128_t num, |
678 | cairo_uint64_t den) |
711 | cairo_uint64_t den) |
679 | { |
712 | { |
680 | cairo_uquorem64_t result; |
713 | cairo_uquorem64_t result; |