Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(201)

Side by Side Diff: include/core/Sk64.h

Issue 119353003: Revert "Revert "begin to remove SkLONGLONG and wean Skia off of Sk64"" (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « include/config/SkUserConfig.h ('k') | include/core/SkFixed.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #ifndef Sk64_DEFINED 10 #ifndef Sk64_DEFINED
11 #define Sk64_DEFINED 11 #define Sk64_DEFINED
12 12
13 #include "SkTypes.h" 13 #include "SkTypes.h"
14 14
15 /** \class Sk64 15 /** \class Sk64
16 16
17 Sk64 is a 64-bit math package that does not require long long support from t he compiler. 17 Sk64 is a 64-bit math package that does not require long long support from t he compiler.
18 */ 18 */
19 struct SK_API Sk64 { 19 struct SK_API Sk64 {
20 private:
20 int32_t fHi; //!< the high 32 bits of the number (including sign) 21 int32_t fHi; //!< the high 32 bits of the number (including sign)
21 uint32_t fLo; //!< the low 32 bits of the number 22 uint32_t fLo; //!< the low 32 bits of the number
22 23
24 public:
25 int32_t hi() const { return fHi; }
26 uint32_t lo() const { return fLo; }
27
28 int64_t as64() const { return ((int64_t)fHi << 32) | fLo; }
29 int64_t getLongLong() const { return this->as64(); }
30
23 /** Returns non-zero if the Sk64 can be represented as a signed 32 bit integ er 31 /** Returns non-zero if the Sk64 can be represented as a signed 32 bit integ er
24 */ 32 */
25 SkBool is32() const { return fHi == ((int32_t)fLo >> 31); } 33 SkBool is32() const { return fHi == ((int32_t)fLo >> 31); }
26 34
27 /** Returns non-zero if the Sk64 cannot be represented as a signed 32 bit in teger 35 /** Returns non-zero if the Sk64 cannot be represented as a signed 32 bit in teger
28 */ 36 */
29 SkBool is64() const { return fHi != ((int32_t)fLo >> 31); } 37 SkBool is64() const { return fHi != ((int32_t)fLo >> 31); }
30 38
31 /** Return the signed 32 bit integer equivalent. Asserts that is32() returns non-zero. 39 /** Return the signed 32 bit integer equivalent. Asserts that is32() returns non-zero.
32 */ 40 */
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 } 170 }
163 171
164 friend bool operator>(const Sk64& a, const Sk64& b) { 172 friend bool operator>(const Sk64& a, const Sk64& b) {
165 return a.fHi > b.fHi || (a.fHi == b.fHi && a.fLo > b.fLo); 173 return a.fHi > b.fHi || (a.fHi == b.fHi && a.fLo > b.fLo);
166 } 174 }
167 175
168 friend bool operator>=(const Sk64& a, const Sk64& b) { 176 friend bool operator>=(const Sk64& a, const Sk64& b) {
169 return a.fHi > b.fHi || (a.fHi == b.fHi && a.fLo >= b.fLo); 177 return a.fHi > b.fHi || (a.fHi == b.fHi && a.fLo >= b.fLo);
170 } 178 }
171 179
172 #ifdef SkLONGLONG 180 // Private to unittests. Parameter is (skiatest::Reporter*)
173 SkLONGLONG getLongLong() const; 181 static void UnitTestWithReporter(void* skiatest_reporter);
174 #endif
175 }; 182 };
176 183
177 #endif 184 #endif
OLDNEW
« no previous file with comments | « include/config/SkUserConfig.h ('k') | include/core/SkFixed.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698