| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| <html xmlns="http://www.w3.org/1999/xhtml"> |
| <head> |
| <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> |
| <title>Skia: include/core/Sk64.h Source File</title> |
| <link href="tabs.css" rel="stylesheet" type="text/css"/> |
| <link href="doxygen.css" rel="stylesheet" type="text/css"/> |
| </head> |
| <body> |
| <!-- Generated by Doxygen 1.6.1 --> |
| <div class="navigation" id="top"> |
| <div class="tabs"> |
| <ul> |
| <li><a href="main.html"><span>Main Page</span></a></li> |
| <li><a href="namespaces.html"><span>Namespaces</span></a></li> |
| <li><a href="annotated.html"><span>Classes</span></a></li> |
| <li class="current"><a href="files.html"><span>Files</span></a></li> |
| </ul> |
| </div> |
| <div class="tabs"> |
| <ul> |
| <li><a href="files.html"><span>File List</span></a></li> |
| <li><a href="globals.html"><span>File Members</span></a></li> |
| </ul> |
| </div> |
| <h1>include/core/Sk64.h</h1><a href="_sk64_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span> |
| <a name="l00002"></a>00002 <span class="comment"> * Copyright (C) 2006 The Android Open Source Project</span> |
| <a name="l00003"></a>00003 <span class="comment"> *</span> |
| <a name="l00004"></a>00004 <span class="comment"> * Licensed under the Apache License, Version 2.0 (the "License");</span> |
| <a name="l00005"></a>00005 <span class="comment"> * you may not use this file except in compliance with the License.</span> |
| <a name="l00006"></a>00006 <span class="comment"> * You may obtain a copy of the License at</span> |
| <a name="l00007"></a>00007 <span class="comment"> *</span> |
| <a name="l00008"></a>00008 <span class="comment"> * http://www.apache.org/licenses/LICENSE-2.0</span> |
| <a name="l00009"></a>00009 <span class="comment"> *</span> |
| <a name="l00010"></a>00010 <span class="comment"> * Unless required by applicable law or agreed to in writing, software</span> |
| <a name="l00011"></a>00011 <span class="comment"> * distributed under the License is distributed on an "AS IS" BASIS,</span> |
| <a name="l00012"></a>00012 <span class="comment"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span> |
| <a name="l00013"></a>00013 <span class="comment"> * See the License for the specific language governing permissions and</span> |
| <a name="l00014"></a>00014 <span class="comment"> * limitations under the License.</span> |
| <a name="l00015"></a>00015 <span class="comment"> */</span> |
| <a name="l00016"></a>00016 |
| <a name="l00017"></a>00017 <span class="preprocessor">#ifndef Sk64_DEFINED</span> |
| <a name="l00018"></a>00018 <span class="preprocessor"></span><span class="preprocessor">#define Sk64_DEFINED</span> |
| <a name="l00019"></a>00019 <span class="preprocessor"></span> |
| <a name="l00020"></a>00020 <span class="preprocessor">#include "<a class="code" href="_sk_fixed_8h.html">SkFixed.h</a>"</span> |
| <a name="l00021"></a>00021 <span class="preprocessor">#include "<a class="code" href="_sk_math_8h.html">SkMath.h</a>"</span> |
| <a name="l00022"></a>00022 |
| <a name="l00027"></a><a class="code" href="struct_sk64.html">00027</a> <span class="keyword">struct </span><a class="code" href="struct_sk64.html">Sk64</a> { |
| <a name="l00028"></a><a class="code" href="struct_sk64.html#ad925415bf762a126c9c977917bd2be4e">00028</a> int32_t <a class="code" href="struct_sk64.html#ad925415bf762a126c9c977917bd2be4e" title="the high 32 bits of the number (including sign)">fHi</a>; |
| <a name="l00029"></a><a class="code" href="struct_sk64.html#a55f6176e57432788786912ec2de1ba12">00029</a> uint32_t <a class="code" href="struct_sk64.html#a55f6176e57432788786912ec2de1ba12" title="the low 32 bits of the number">fLo</a>; |
| <a name="l00030"></a>00030 |
| <a name="l00033"></a><a class="code" href="struct_sk64.html#adae037a841ce12e07d3eeb7245d19dde">00033</a> <a class="code" href="_sk_types_8h.html#aa01c558c8b2ec5be06507f6236c4e044">SkBool</a> <a class="code" href="struct_sk64.html#adae037a841ce12e07d3eeb7245d19dde">is32</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="struct_sk64.html#ad925415bf762a126c9c977917bd2be4e" title="the high 32 bits of the number (including sign)">fHi</a> == ((int32_t)<a class="code" href="struct_sk64.html#a55f6176e57432788786912ec2de1ba12" title="the low 32 bits of the number">fLo</a> >> 31); } |
| <a name="l00034"></a>00034 |
| <a name="l00037"></a><a class="code" href="struct_sk64.html#a568ba9530cadc0b4a099275d28d9d6b1">00037</a> <a class="code" href="_sk_types_8h.html#aa01c558c8b2ec5be06507f6236c4e044">SkBool</a> <a class="code" href="struct_sk64.html#a568ba9530cadc0b4a099275d28d9d6b1">is64</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="struct_sk64.html#ad925415bf762a126c9c977917bd2be4e" title="the high 32 bits of the number (including sign)">fHi</a> != ((int32_t)<a class="code" href="struct_sk64.html#a55f6176e57432788786912ec2de1ba12" title="the low 32 bits of the number">fLo</a> >> 31); } |
| <a name="l00038"></a>00038 |
| <a name="l00042"></a>00042 <a class="code" href="_sk_types_8h.html#aa01c558c8b2ec5be06507f6236c4e044">SkBool</a> <a class="code" href="struct_sk64.html#ad348888196f5642f8df652f7d9ab6c32">isFixed</a>() <span class="keyword">const</span>; |
| <a name="l00043"></a>00043 |
| <a name="l00046"></a><a class="code" href="struct_sk64.html#a21ae2ca7b0cbb1ffad44a6485b7fcc2a">00046</a> int32_t <a class="code" href="struct_sk64.html#a21ae2ca7b0cbb1ffad44a6485b7fcc2a">get32</a>()<span class="keyword"> const </span>{ <a class="code" href="_sk_types_8h.html#acc82ca88a67ae7ce95a107a9a4b81123">SkASSERT</a>(this-><a class="code" href="struct_sk64.html#adae037a841ce12e07d3eeb7245d19dde">is32</a>()); <span class="keywordflow">return</span> (int32_t)<a class="code" href="struct_sk64.html#a55f6176e57432788786912ec2de1ba12" title="the low 32 bits of the number">fLo</a>; } |
| <a name="l00047"></a>00047 |
| <a name="l00050"></a><a class="code" href="struct_sk64.html#ada8e94496f808dd8c94c6ab0ba114f15">00050</a> <a class="code" href="_sk_fixed_8h.html#a2f208c049f1e9eb4d35b8c47615f5c47">SkFixed</a> <a class="code" href="struct_sk64.html#ada8e94496f808dd8c94c6ab0ba114f15">getFixed</a>()<span class="keyword"> const </span>{ |
| <a name="l00051"></a>00051 <a class="code" href="_sk_types_8h.html#acc82ca88a67ae7ce95a107a9a4b81123">SkASSERT</a>(this-><a class="code" href="struct_sk64.html#ad348888196f5642f8df652f7d9ab6c32">isFixed</a>()); |
| <a name="l00052"></a>00052 |
| <a name="l00053"></a>00053 uint32_t sum = <a class="code" href="struct_sk64.html#a55f6176e57432788786912ec2de1ba12" title="the low 32 bits of the number">fLo</a> + (1 << 15); |
| <a name="l00054"></a>00054 int32_t hi = <a class="code" href="struct_sk64.html#ad925415bf762a126c9c977917bd2be4e" title="the high 32 bits of the number (including sign)">fHi</a>; |
| <a name="l00055"></a>00055 <span class="keywordflow">if</span> (sum < <a class="code" href="struct_sk64.html#a55f6176e57432788786912ec2de1ba12" title="the low 32 bits of the number">fLo</a>) { |
| <a name="l00056"></a>00056 hi += 1; |
| <a name="l00057"></a>00057 } |
| <a name="l00058"></a>00058 <span class="keywordflow">return</span> (hi << 16) | (sum >> 16); |
| <a name="l00059"></a>00059 } |
| <a name="l00060"></a>00060 |
| <a name="l00064"></a>00064 <a class="code" href="_sk_fixed_8h.html#a6d0de01bbaf83f12dfa75c6f62c6a191">SkFract</a> <a class="code" href="struct_sk64.html#a8a931c734c3736be9c7627784c764b69">getFract</a>() <span class="keyword">const</span>; |
| <a name="l00065"></a>00065 |
| <a name="l00067"></a>00067 int32_t <a class="code" href="struct_sk64.html#a8dbc350bf09607802ed3fe9f08a7c484">getSqrt</a>() <span class="keyword">const</span>; |
| <a name="l00068"></a>00068 |
| <a name="l00072"></a>00072 <span class="keywordtype">int</span> <a class="code" href="struct_sk64.html#ad6a49cfcc34941449f83825aee165117">getClzAbs</a>() <span class="keyword">const</span>; |
| <a name="l00073"></a>00073 |
| <a name="l00075"></a><a class="code" href="struct_sk64.html#a1addddb71cc218da761091a73171693b">00075</a> <a class="code" href="_sk_types_8h.html#aa01c558c8b2ec5be06507f6236c4e044">SkBool</a> <a class="code" href="struct_sk64.html#a1addddb71cc218da761091a73171693b">isZero</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> (<a class="code" href="struct_sk64.html#ad925415bf762a126c9c977917bd2be4e" title="the high 32 bits of the number (including sign)">fHi</a> | <a class="code" href="struct_sk64.html#a55f6176e57432788786912ec2de1ba12" title="the low 32 bits of the number">fLo</a>) == 0; } |
| <a name="l00076"></a>00076 |
| <a name="l00078"></a><a class="code" href="struct_sk64.html#a6b6818674010f887daa7d610a000b544">00078</a> <a class="code" href="_sk_types_8h.html#aa01c558c8b2ec5be06507f6236c4e044">SkBool</a> <a class="code" href="struct_sk64.html#a6b6818674010f887daa7d610a000b544">nonZero</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="struct_sk64.html#ad925415bf762a126c9c977917bd2be4e" title="the high 32 bits of the number (including sign)">fHi</a> | <a class="code" href="struct_sk64.html#a55f6176e57432788786912ec2de1ba12" title="the low 32 bits of the number">fLo</a>; } |
| <a name="l00079"></a>00079 |
| <a name="l00081"></a><a class="code" href="struct_sk64.html#a35f2d6bfda4aa95b9c74b6bf546ed6b8">00081</a> <a class="code" href="_sk_types_8h.html#aa01c558c8b2ec5be06507f6236c4e044">SkBool</a> <a class="code" href="struct_sk64.html#a35f2d6bfda4aa95b9c74b6bf546ed6b8">isNeg</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> (uint32_t)<a class="code" href="struct_sk64.html#ad925415bf762a126c9c977917bd2be4e" title="the high 32 bits of the number (including sign)">fHi</a> >> 31; } |
| <a name="l00082"></a>00082 |
| <a name="l00084"></a><a class="code" href="struct_sk64.html#a8bc7b978d15c1f08fe6b57f7241bec1a">00084</a> <a class="code" href="_sk_types_8h.html#aa01c558c8b2ec5be06507f6236c4e044">SkBool</a> <a class="code" href="struct_sk64.html#a8bc7b978d15c1f08fe6b57f7241bec1a">isPos</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> ~(<a class="code" href="struct_sk64.html#ad925415bf762a126c9c977917bd2be4e" title="the high 32 bits of the number (including sign)">fHi</a> >> 31) & (<a class="code" href="struct_sk64.html#ad925415bf762a126c9c977917bd2be4e" title="the high 32 bits of the number (including sign)">fHi</a> | <a class="code" href="struct_sk64.html#a55f6176e57432788786912ec2de1ba12" title="the low 32 bits of the number">fLo</a>); } |
| <a name="l00085"></a>00085 |
| <a name="l00087"></a><a class="code" href="struct_sk64.html#afd52521fdaca3ee9c96d507e8ebe64ca">00087</a> <span class="keywordtype">int</span> <a class="code" href="struct_sk64.html#afd52521fdaca3ee9c96d507e8ebe64ca">getSign</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> (<a class="code" href="struct_sk64.html#ad925415bf762a126c9c977917bd2be4e" title="the high 32 bits of the number (including sign)">fHi</a> >> 31) | Sk32ToBool(<a class="code" href="struct_sk64.html#ad925415bf762a126c9c977917bd2be4e" title="the high 32 bits of the number (including sign)">fHi</a> | <a class="code" href="struct_sk64.html#a55f6176e57432788786912ec2de1ba12" title="the low 32 bits of the number">fLo</a>); } |
| <a name="l00088"></a>00088 |
| <a name="l00090"></a>00090 <span class="keywordtype">void</span> <a class="code" href="struct_sk64.html#af78ba5f0c76dae98b8abb63d8d93718c">negate</a>(); |
| <a name="l00091"></a>00091 |
| <a name="l00094"></a>00094 <span class="keywordtype">void</span> <a class="code" href="struct_sk64.html#a2287a241d59016b2df41dfe72c2cee48">abs</a>(); |
| <a name="l00095"></a>00095 |
| <a name="l00099"></a>00099 <span class="keywordtype">int</span> <a class="code" href="struct_sk64.html#a5cfa624542f6f73c1c1b5b8dfc89bc43">shiftToMake32</a>() <span class="keyword">const</span>; |
| <a name="l00100"></a>00100 |
| <a name="l00102"></a><a class="code" href="struct_sk64.html#a8492aff7061f7cd33743133ba4889257">00102</a> <span class="keywordtype">void</span> <a class="code" href="struct_sk64.html#a8492aff7061f7cd33743133ba4889257">setZero</a>() { <a class="code" href="struct_sk64.html#ad925415bf762a126c9c977917bd2be4e" title="the high 32 bits of the number (including sign)">fHi</a> = <a class="code" href="struct_sk64.html#a55f6176e57432788786912ec2de1ba12" title="the low 32 bits of the number">fLo</a> = 0; } |
| <a name="l00103"></a>00103 |
| <a name="l00105"></a><a class="code" href="struct_sk64.html#a803070200fa85dfcfd67966eb7ccc9a9">00105</a> <span class="keywordtype">void</span> <span class="keyword">set</span>(int32_t hi, uint32_t lo) { <a class="code" href="struct_sk64.html#ad925415bf762a126c9c977917bd2be4e" title="the high 32 bits of the number (including sign)">fHi</a> = hi; <a class="code" href="struct_sk64.html#a55f6176e57432788786912ec2de1ba12" title="the low 32 bits of the number">fLo</a> = lo; } |
| <a name="l00106"></a>00106 |
| <a name="l00108"></a><a class="code" href="struct_sk64.html#a62de09afb36478d8f08d5a8ccf0b81ff">00108</a> <span class="keywordtype">void</span> <span class="keyword">set</span>(int32_t a) { <a class="code" href="struct_sk64.html#ad925415bf762a126c9c977917bd2be4e" title="the high 32 bits of the number (including sign)">fHi</a> = a >> 31; <a class="code" href="struct_sk64.html#a55f6176e57432788786912ec2de1ba12" title="the low 32 bits of the number">fLo</a> = a; } |
| <a name="l00109"></a>00109 |
| <a name="l00111"></a>00111 <span class="keywordtype">void</span> <a class="code" href="struct_sk64.html#a8f58e62643bf385d4948c2ffd1bcbadd">setMul</a>(int32_t a, int32_t b); |
| <a name="l00112"></a>00112 |
| <a name="l00117"></a>00117 int32_t <a class="code" href="struct_sk64.html#a0409aabea50bdbb9c771aa03a4fe24dc">getShiftRight</a>(<span class="keywordtype">unsigned</span> bitCount) <span class="keyword">const</span>; |
| <a name="l00118"></a>00118 |
| <a name="l00122"></a>00122 <span class="keywordtype">void</span> <a class="code" href="struct_sk64.html#a1230680c5124472977aeb05d27694699">shiftLeft</a>(<span class="keywordtype">unsigned</span> bits); |
| <a name="l00123"></a>00123 |
| <a name="l00128"></a>00128 <span class="keywordtype">void</span> <a class="code" href="struct_sk64.html#ad9cbb3e581aae586b339bbf62df3e596">shiftRight</a>(<span class="keywordtype">unsigned</span> bits); |
| <a name="l00129"></a>00129 |
| <a name="l00135"></a>00135 <span class="keywordtype">void</span> <a class="code" href="struct_sk64.html#a94b2d9133740d0e53bff745db8293c6a">roundRight</a>(<span class="keywordtype">unsigned</span> bits); |
| <a name="l00136"></a>00136 |
| <a name="l00138"></a><a class="code" href="struct_sk64.html#aa2326e630f1c8653b6d625c595367ea3">00138</a> <span class="keywordtype">void</span> <a class="code" href="struct_sk64.html#aa2326e630f1c8653b6d625c595367ea3">add</a>(int32_t lo) { |
| <a name="l00139"></a>00139 int32_t hi = lo >> 31; <span class="comment">// 0 or -1</span> |
| <a name="l00140"></a>00140 uint32_t sum = <a class="code" href="struct_sk64.html#a55f6176e57432788786912ec2de1ba12" title="the low 32 bits of the number">fLo</a> + (uint32_t)lo; |
| <a name="l00141"></a>00141 |
| <a name="l00142"></a>00142 <a class="code" href="struct_sk64.html#ad925415bf762a126c9c977917bd2be4e" title="the high 32 bits of the number (including sign)">fHi</a> = fHi + hi + (sum < <a class="code" href="struct_sk64.html#a55f6176e57432788786912ec2de1ba12" title="the low 32 bits of the number">fLo</a>); |
| <a name="l00143"></a>00143 <a class="code" href="struct_sk64.html#a55f6176e57432788786912ec2de1ba12" title="the low 32 bits of the number">fLo</a> = sum; |
| <a name="l00144"></a>00144 } |
| <a name="l00145"></a>00145 |
| <a name="l00147"></a><a class="code" href="struct_sk64.html#a2da5af353aab4273b7f3169973340cd5">00147</a> <span class="keywordtype">void</span> <a class="code" href="struct_sk64.html#a2da5af353aab4273b7f3169973340cd5">add</a>(int32_t hi, uint32_t lo) { |
| <a name="l00148"></a>00148 uint32_t sum = <a class="code" href="struct_sk64.html#a55f6176e57432788786912ec2de1ba12" title="the low 32 bits of the number">fLo</a> + lo; |
| <a name="l00149"></a>00149 |
| <a name="l00150"></a>00150 <a class="code" href="struct_sk64.html#ad925415bf762a126c9c977917bd2be4e" title="the high 32 bits of the number (including sign)">fHi</a> = <a class="code" href="struct_sk64.html#ad925415bf762a126c9c977917bd2be4e" title="the high 32 bits of the number (including sign)">fHi</a> + hi + (sum < <a class="code" href="struct_sk64.html#a55f6176e57432788786912ec2de1ba12" title="the low 32 bits of the number">fLo</a>); |
| <a name="l00151"></a>00151 <a class="code" href="struct_sk64.html#a55f6176e57432788786912ec2de1ba12" title="the low 32 bits of the number">fLo</a> = sum; |
| <a name="l00152"></a>00152 } |
| <a name="l00153"></a>00153 |
| <a name="l00155"></a><a class="code" href="struct_sk64.html#a314468c7172044586307deda674cbc7c">00155</a> <span class="keywordtype">void</span> <a class="code" href="struct_sk64.html#a314468c7172044586307deda674cbc7c">add</a>(<span class="keyword">const</span> <a class="code" href="struct_sk64.html">Sk64</a>& other) { this-><a class="code" href="struct_sk64.html#a314468c7172044586307deda674cbc7c">add</a>(other.<a class="code" href="struct_sk64.html#ad925415bf762a126c9c977917bd2be4e" title="the high 32 bits of the number (including sign)">fHi</a>, other.<a class="code" href="struct_sk64.html#a55f6176e57432788786912ec2de1ba12" title="the low 32 bits of the number">fLo</a>); } |
| <a name="l00156"></a>00156 |
| <a name="l00159"></a>00159 <span class="keywordtype">void</span> <a class="code" href="struct_sk64.html#a05d69927f2d8f995806588aaad70bb81">sub</a>(<span class="keyword">const</span> <a class="code" href="struct_sk64.html">Sk64</a>& num); |
| <a name="l00160"></a>00160 |
| <a name="l00163"></a>00163 <span class="keywordtype">void</span> <a class="code" href="struct_sk64.html#af83c5c6e07b915fd35ff79b04afa7cf6">rsub</a>(<span class="keyword">const</span> <a class="code" href="struct_sk64.html">Sk64</a>& num); |
| <a name="l00164"></a>00164 |
| <a name="l00167"></a>00167 <span class="keywordtype">void</span> <a class="code" href="struct_sk64.html#a9fff42997db3b6e310e2b6dc8a501942">mul</a>(int32_t); |
| <a name="l00168"></a>00168 |
| <a name="l00169"></a><a class="code" href="struct_sk64.html#a41410b4199f563131a2ae1ab6e195c3f">00169</a> <span class="keyword">enum</span> <a class="code" href="struct_sk64.html#a41410b4199f563131a2ae1ab6e195c3f">DivOptions</a> { |
| <a name="l00170"></a><a class="code" href="struct_sk64.html#a41410b4199f563131a2ae1ab6e195c3fa65bf4a011f2ec13a03e62ae34407746b">00170</a> <a class="code" href="struct_sk64.html#a41410b4199f563131a2ae1ab6e195c3fa65bf4a011f2ec13a03e62ae34407746b" title="truncate the result when calling div()">kTrunc_DivOption</a>, |
| <a name="l00171"></a><a class="code" href="struct_sk64.html#a41410b4199f563131a2ae1ab6e195c3fa95c2b9a59d57af7cc0eb7198b5714a32">00171</a> <a class="code" href="struct_sk64.html#a41410b4199f563131a2ae1ab6e195c3fa95c2b9a59d57af7cc0eb7198b5714a32" title="round the result when calling div()">kRound_DivOption</a> |
| <a name="l00172"></a>00172 }; |
| <a name="l00173"></a>00173 |
| <a name="l00177"></a>00177 <span class="keywordtype">void</span> <a class="code" href="struct_sk64.html#a68613c733ca32a31becf12dd86dcb56d">div</a>(int32_t, <a class="code" href="struct_sk64.html#a41410b4199f563131a2ae1ab6e195c3f">DivOptions</a>); |
| <a name="l00178"></a>00178 |
| <a name="l00180"></a><a class="code" href="struct_sk64.html#a26a1d2e7a7effa467198af687bd32df3">00180</a> <a class="code" href="_sk_fixed_8h.html#a2f208c049f1e9eb4d35b8c47615f5c47">SkFixed</a> <a class="code" href="struct_sk64.html#a26a1d2e7a7effa467198af687bd32df3">addGetFixed</a>(<span class="keyword">const</span> <a class="code" href="struct_sk64.html">Sk64</a>& other)<span class="keyword"> const </span>{ |
| <a name="l00181"></a>00181 <span class="keywordflow">return</span> this-><a class="code" href="struct_sk64.html#a26a1d2e7a7effa467198af687bd32df3">addGetFixed</a>(other.<a class="code" href="struct_sk64.html#ad925415bf762a126c9c977917bd2be4e" title="the high 32 bits of the number (including sign)">fHi</a>, other.<a class="code" href="struct_sk64.html#a55f6176e57432788786912ec2de1ba12" title="the low 32 bits of the number">fLo</a>); |
| <a name="l00182"></a>00182 } |
| <a name="l00183"></a>00183 |
| <a name="l00185"></a><a class="code" href="struct_sk64.html#ad120fc7d8813f9332642406f50028cf3">00185</a> <a class="code" href="_sk_fixed_8h.html#a2f208c049f1e9eb4d35b8c47615f5c47">SkFixed</a> <a class="code" href="struct_sk64.html#ad120fc7d8813f9332642406f50028cf3">addGetFixed</a>(int32_t hi, uint32_t lo)<span class="keyword"> const </span>{ |
| <a name="l00186"></a>00186 <span class="preprocessor">#ifdef SK_DEBUG</span> |
| <a name="l00187"></a>00187 <span class="preprocessor"></span> <a class="code" href="struct_sk64.html">Sk64</a> tmp(*<span class="keyword">this</span>); |
| <a name="l00188"></a>00188 tmp.<a class="code" href="struct_sk64.html#aa2326e630f1c8653b6d625c595367ea3">add</a>(hi, lo); |
| <a name="l00189"></a>00189 <span class="preprocessor">#endif</span> |
| <a name="l00190"></a>00190 <span class="preprocessor"></span> |
| <a name="l00191"></a>00191 uint32_t sum = <a class="code" href="struct_sk64.html#a55f6176e57432788786912ec2de1ba12" title="the low 32 bits of the number">fLo</a> + lo; |
| <a name="l00192"></a>00192 hi += <a class="code" href="struct_sk64.html#ad925415bf762a126c9c977917bd2be4e" title="the high 32 bits of the number (including sign)">fHi</a> + (sum < <a class="code" href="struct_sk64.html#a55f6176e57432788786912ec2de1ba12" title="the low 32 bits of the number">fLo</a>); |
| <a name="l00193"></a>00193 lo = sum; |
| <a name="l00194"></a>00194 |
| <a name="l00195"></a>00195 sum = lo + (1 << 15); |
| <a name="l00196"></a>00196 <span class="keywordflow">if</span> (sum < lo) |
| <a name="l00197"></a>00197 hi += 1; |
| <a name="l00198"></a>00198 |
| <a name="l00199"></a>00199 hi = (hi << 16) | (sum >> 16); |
| <a name="l00200"></a>00200 <a class="code" href="_sk_types_8h.html#acc82ca88a67ae7ce95a107a9a4b81123">SkASSERT</a>(hi == tmp.<a class="code" href="struct_sk64.html#ada8e94496f808dd8c94c6ab0ba114f15">getFixed</a>()); |
| <a name="l00201"></a>00201 <span class="keywordflow">return</span> hi; |
| <a name="l00202"></a>00202 } |
| <a name="l00203"></a>00203 |
| <a name="l00207"></a>00207 <a class="code" href="_sk_fixed_8h.html#a2f208c049f1e9eb4d35b8c47615f5c47">SkFixed</a> <a class="code" href="struct_sk64.html#ac213be1aff35262398a689a6f0c0007b">getFixedDiv</a>(<span class="keyword">const</span> <a class="code" href="struct_sk64.html">Sk64</a>& denom) <span class="keyword">const</span>; |
| <a name="l00208"></a>00208 |
| <a name="l00209"></a><a class="code" href="struct_sk64.html#a52ff55c593243eb81b6b1787f790ab82">00209</a> <span class="keyword">friend</span> <span class="keywordtype">bool</span> <a class="code" href="struct_sk64.html#a52ff55c593243eb81b6b1787f790ab82">operator==</a>(<span class="keyword">const</span> <a class="code" href="struct_sk64.html">Sk64</a>& a, <span class="keyword">const</span> <a class="code" href="struct_sk64.html">Sk64</a>& b) { |
| <a name="l00210"></a>00210 <span class="keywordflow">return</span> a.<a class="code" href="struct_sk64.html#ad925415bf762a126c9c977917bd2be4e" title="the high 32 bits of the number (including sign)">fHi</a> == b.<a class="code" href="struct_sk64.html#ad925415bf762a126c9c977917bd2be4e" title="the high 32 bits of the number (including sign)">fHi</a> && a.<a class="code" href="struct_sk64.html#a55f6176e57432788786912ec2de1ba12" title="the low 32 bits of the number">fLo</a> == b.<a class="code" href="struct_sk64.html#a55f6176e57432788786912ec2de1ba12" title="the low 32 bits of the number">fLo</a>; |
| <a name="l00211"></a>00211 } |
| <a name="l00212"></a>00212 |
| <a name="l00213"></a><a class="code" href="struct_sk64.html#a598ba5583ea61c23ad25020dfdcbb14c">00213</a> <span class="keyword">friend</span> <span class="keywordtype">bool</span> <a class="code" href="struct_sk64.html#a598ba5583ea61c23ad25020dfdcbb14c">operator!=</a>(<span class="keyword">const</span> <a class="code" href="struct_sk64.html">Sk64</a>& a, <span class="keyword">const</span> <a class="code" href="struct_sk64.html">Sk64</a>& b) { |
| <a name="l00214"></a>00214 <span class="keywordflow">return</span> a.<a class="code" href="struct_sk64.html#ad925415bf762a126c9c977917bd2be4e" title="the high 32 bits of the number (including sign)">fHi</a> != b.<a class="code" href="struct_sk64.html#ad925415bf762a126c9c977917bd2be4e" title="the high 32 bits of the number (including sign)">fHi</a> || a.<a class="code" href="struct_sk64.html#a55f6176e57432788786912ec2de1ba12" title="the low 32 bits of the number">fLo</a> != b.<a class="code" href="struct_sk64.html#a55f6176e57432788786912ec2de1ba12" title="the low 32 bits of the number">fLo</a>; |
| <a name="l00215"></a>00215 } |
| <a name="l00216"></a>00216 |
| <a name="l00217"></a><a class="code" href="struct_sk64.html#a25742b440b5e3b0e6a3afe0a78bd96e7">00217</a> <span class="keyword">friend</span> <span class="keywordtype">bool</span> <a class="code" href="struct_sk64.html#a25742b440b5e3b0e6a3afe0a78bd96e7">operator<</a>(<span class="keyword">const</span> <a class="code" href="struct_sk64.html">Sk64</a>& a, <span class="keyword">const</span> <a class="code" href="struct_sk64.html">Sk64</a>& b) { |
| <a name="l00218"></a>00218 <span class="keywordflow">return</span> a.<a class="code" href="struct_sk64.html#ad925415bf762a126c9c977917bd2be4e" title="the high 32 bits of the number (including sign)">fHi</a> < b.<a class="code" href="struct_sk64.html#ad925415bf762a126c9c977917bd2be4e" title="the high 32 bits of the number (including sign)">fHi</a> || (a.<a class="code" href="struct_sk64.html#ad925415bf762a126c9c977917bd2be4e" title="the high 32 bits of the number (including sign)">fHi</a> == b.<a class="code" href="struct_sk64.html#ad925415bf762a126c9c977917bd2be4e" title="the high 32 bits of the number (including sign)">fHi</a> && a.<a class="code" href="struct_sk64.html#a55f6176e57432788786912ec2de1ba12" title="the low 32 bits of the number">fLo</a> < b.<a class="code" href="struct_sk64.html#a55f6176e57432788786912ec2de1ba12" title="the low 32 bits of the number">fLo</a>); |
| <a name="l00219"></a>00219 } |
| <a name="l00220"></a>00220 |
| <a name="l00221"></a><a class="code" href="struct_sk64.html#a4672aa6008fdbd2975cc12d130f6fe58">00221</a> <span class="keyword">friend</span> <span class="keywordtype">bool</span> <a class="code" href="struct_sk64.html#a4672aa6008fdbd2975cc12d130f6fe58">operator<=</a>(<span class="keyword">const</span> <a class="code" href="struct_sk64.html">Sk64</a>& a, <span class="keyword">const</span> <a class="code" href="struct_sk64.html">Sk64</a>& b) { |
| <a name="l00222"></a>00222 <span class="keywordflow">return</span> a.<a class="code" href="struct_sk64.html#ad925415bf762a126c9c977917bd2be4e" title="the high 32 bits of the number (including sign)">fHi</a> < b.<a class="code" href="struct_sk64.html#ad925415bf762a126c9c977917bd2be4e" title="the high 32 bits of the number (including sign)">fHi</a> || (a.<a class="code" href="struct_sk64.html#ad925415bf762a126c9c977917bd2be4e" title="the high 32 bits of the number (including sign)">fHi</a> == b.<a class="code" href="struct_sk64.html#ad925415bf762a126c9c977917bd2be4e" title="the high 32 bits of the number (including sign)">fHi</a> && a.<a class="code" href="struct_sk64.html#a55f6176e57432788786912ec2de1ba12" title="the low 32 bits of the number">fLo</a> <= b.<a class="code" href="struct_sk64.html#a55f6176e57432788786912ec2de1ba12" title="the low 32 bits of the number">fLo</a>); |
| <a name="l00223"></a>00223 } |
| <a name="l00224"></a>00224 |
| <a name="l00225"></a><a class="code" href="struct_sk64.html#ae8abade3a5ee069b8b95a2c5599ea50a">00225</a> <span class="keyword">friend</span> <span class="keywordtype">bool</span> <a class="code" href="struct_sk64.html#ae8abade3a5ee069b8b95a2c5599ea50a">operator></a>(<span class="keyword">const</span> <a class="code" href="struct_sk64.html">Sk64</a>& a, <span class="keyword">const</span> <a class="code" href="struct_sk64.html">Sk64</a>& b) { |
| <a name="l00226"></a>00226 <span class="keywordflow">return</span> a.<a class="code" href="struct_sk64.html#ad925415bf762a126c9c977917bd2be4e" title="the high 32 bits of the number (including sign)">fHi</a> > b.<a class="code" href="struct_sk64.html#ad925415bf762a126c9c977917bd2be4e" title="the high 32 bits of the number (including sign)">fHi</a> || (a.<a class="code" href="struct_sk64.html#ad925415bf762a126c9c977917bd2be4e" title="the high 32 bits of the number (including sign)">fHi</a> == b.<a class="code" href="struct_sk64.html#ad925415bf762a126c9c977917bd2be4e" title="the high 32 bits of the number (including sign)">fHi</a> && a.<a class="code" href="struct_sk64.html#a55f6176e57432788786912ec2de1ba12" title="the low 32 bits of the number">fLo</a> > b.<a class="code" href="struct_sk64.html#a55f6176e57432788786912ec2de1ba12" title="the low 32 bits of the number">fLo</a>); |
| <a name="l00227"></a>00227 } |
| <a name="l00228"></a>00228 |
| <a name="l00229"></a><a class="code" href="struct_sk64.html#acdc89440f9b2e979e43caf7adfe20789">00229</a> <span class="keyword">friend</span> <span class="keywordtype">bool</span> <a class="code" href="struct_sk64.html#acdc89440f9b2e979e43caf7adfe20789">operator>=</a>(<span class="keyword">const</span> <a class="code" href="struct_sk64.html">Sk64</a>& a, <span class="keyword">const</span> <a class="code" href="struct_sk64.html">Sk64</a>& b) { |
| <a name="l00230"></a>00230 <span class="keywordflow">return</span> a.<a class="code" href="struct_sk64.html#ad925415bf762a126c9c977917bd2be4e" title="the high 32 bits of the number (including sign)">fHi</a> > b.<a class="code" href="struct_sk64.html#ad925415bf762a126c9c977917bd2be4e" title="the high 32 bits of the number (including sign)">fHi</a> || (a.<a class="code" href="struct_sk64.html#ad925415bf762a126c9c977917bd2be4e" title="the high 32 bits of the number (including sign)">fHi</a> == b.<a class="code" href="struct_sk64.html#ad925415bf762a126c9c977917bd2be4e" title="the high 32 bits of the number (including sign)">fHi</a> && a.<a class="code" href="struct_sk64.html#a55f6176e57432788786912ec2de1ba12" title="the low 32 bits of the number">fLo</a> >= b.<a class="code" href="struct_sk64.html#a55f6176e57432788786912ec2de1ba12" title="the low 32 bits of the number">fLo</a>); |
| <a name="l00231"></a>00231 } |
| <a name="l00232"></a>00232 |
| <a name="l00233"></a>00233 <span class="preprocessor">#ifdef SkLONGLONG</span> |
| <a name="l00234"></a>00234 <span class="preprocessor"></span> SkLONGLONG getLongLong() <span class="keyword">const</span>; |
| <a name="l00235"></a>00235 <span class="preprocessor">#endif</span> |
| <a name="l00236"></a>00236 <span class="preprocessor"></span>}; |
| <a name="l00237"></a>00237 |
| <a name="l00238"></a>00238 <span class="preprocessor">#endif</span> |
| <a name="l00239"></a>00239 <span class="preprocessor"></span> |
| </pre></div></div> |
| <hr size="1"/><address style="text-align: right;"><small>Generated on Tue Oct 20 11:03:40 2009 for Skia by |
| <a href="http://www.doxygen.org/index.html"> |
| <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.1 </small></address> |
| </body> |
| </html> |