OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "Sk64.h" | 8 #include "Sk64.h" |
9 #include "SkMathPriv.h" | 9 #include "SkMathPriv.h" |
10 | 10 |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 { | 292 { |
293 sqr -= testDiv; | 293 sqr -= testDiv; |
294 root++; | 294 root++; |
295 } | 295 } |
296 } while (--count >= 0); | 296 } while (--count >= 0); |
297 SkASSERT((int32_t)root >= 0); | 297 SkASSERT((int32_t)root >= 0); |
298 | 298 |
299 return root; | 299 return root; |
300 } | 300 } |
301 | 301 |
302 #ifdef SkLONGLONG | |
303 SkLONGLONG Sk64::getLongLong() const | |
304 { | |
305 SkLONGLONG value = fHi; | |
306 value <<= 32; | |
307 return value | fLo; | |
308 } | |
309 #endif | |
310 | |
311 SkFixed Sk64::getFixedDiv(const Sk64& denom) const | 302 SkFixed Sk64::getFixedDiv(const Sk64& denom) const |
312 { | 303 { |
313 Sk64 N = *this; | 304 Sk64 N = *this; |
314 Sk64 D = denom; | 305 Sk64 D = denom; |
315 int32_t sign = SkExtractSign(N.fHi ^ D.fHi); | 306 int32_t sign = SkExtractSign(N.fHi ^ D.fHi); |
316 SkFixed result; | 307 SkFixed result; |
317 | 308 |
318 N.abs(); | 309 N.abs(); |
319 D.abs(); | 310 D.abs(); |
320 | 311 |
(...skipping 24 matching lines...) Expand all Loading... |
345 else | 336 else |
346 N.roundRight(-shiftN); | 337 N.roundRight(-shiftN); |
347 N.div(D.get32(), Sk64::kTrunc_DivOption); | 338 N.div(D.get32(), Sk64::kTrunc_DivOption); |
348 if (N.is32()) | 339 if (N.is32()) |
349 result = N.get32(); | 340 result = N.get32(); |
350 else | 341 else |
351 result = SK_MaxS32; | 342 result = SK_MaxS32; |
352 } | 343 } |
353 return SkApplySign(result, sign); | 344 return SkApplySign(result, sign); |
354 } | 345 } |
OLD | NEW |