OLD | NEW |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2006 INRIA | 3 * Copyright (c) 2006 INRIA |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 5 * This program is free software; you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 2 as | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 ( !(den.lo & 0x1) || _cairo_uint128_lt (rem, den) ) ) | 167 ( !(den.lo & 0x1) || _cairo_uint128_lt (rem, den) ) ) |
168 { | 168 { |
169 ++shift; | 169 ++shift; |
170 den = _cairo_uint128_rsl (den, 1); | 170 den = _cairo_uint128_rsl (den, 1); |
171 } | 171 } |
172 | 172 |
173 // Do the division | 173 // Do the division |
174 qr = _cairo_uint128_divrem (rem, den); | 174 qr = _cairo_uint128_divrem (rem, den); |
175 | 175 |
176 // Add in the quotient as shift bits of the fraction | 176 // Add in the quotient as shift bits of the fraction |
177 result = _cairo_uint128_lsl (result, shift); | 177 result = _cairo_uint128_lsl (result, static_cast<int> (shift)); |
178 result = _cairo_uint128_add (result, qr.quo); | 178 result = _cairo_uint128_add (result, qr.quo); |
179 rem = qr.rem; | 179 rem = qr.rem; |
180 digis += shift; | 180 digis += shift; |
181 shift = 0; | 181 shift = 0; |
182 } | 182 } |
183 // Did we run out of remainder? | 183 // Did we run out of remainder? |
184 if (digis < DIGITS) | 184 if (digis < DIGITS) |
185 { | 185 { |
186 shift = DIGITS - digis; | 186 shift = DIGITS - digis; |
187 result = _cairo_uint128_lsl (result, shift); | 187 result = _cairo_uint128_lsl (result, static_cast<int> (shift)); |
188 } | 188 } |
189 ·· | 189 ·· |
190 return result; | 190 return result; |
191 } | 191 } |
192 | 192 |
193 void· | 193 void· |
194 int64x64_t::MulByInvert (const int64x64_t & o) | 194 int64x64_t::MulByInvert (const int64x64_t & o) |
195 { | 195 { |
196 bool sign = _cairo_int128_negative (_v); | 196 bool sign = _cairo_int128_negative (_v); |
197 cairo_uint128_t a = sign ? _cairo_int128_negate (_v) : _v; | 197 cairo_uint128_t a = sign ? _cairo_int128_negate (_v) : _v; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 if (tmp.GetHigh () != 1) | 230 if (tmp.GetHigh () != 1) |
231 { | 231 { |
232 cairo_uint128_t one = { 1, 0}; | 232 cairo_uint128_t one = { 1, 0}; |
233 result._v = _cairo_uint128_add (result._v, one); | 233 result._v = _cairo_uint128_add (result._v, one); |
234 } | 234 } |
235 return result; | 235 return result; |
236 } | 236 } |
237 | 237 |
238 | 238 |
239 } // namespace ns3 | 239 } // namespace ns3 |
OLD | NEW |