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

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

Issue 122283002: Revert of remove Sk64 from public API, and start to remove usage internally (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 11 months 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 | « no previous file | include/core/SkBitmap.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 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
3 * 4 *
4 * 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
5 * found in the LICENSE file. 6 * found in the LICENSE file.
6 */ 7 */
7 8
9
8 #ifndef Sk64_DEFINED 10 #ifndef Sk64_DEFINED
9 #define Sk64_DEFINED 11 #define Sk64_DEFINED
10 12
11 #include "SkTypes.h" 13 #include "SkTypes.h"
12 14
13 /** \class Sk64 15 /** \class Sk64
14 16
15 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.
16 */ 18 */
17 struct SK_API Sk64 { 19 struct SK_API Sk64 {
18 private: 20 private:
19 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)
20 uint32_t fLo; //!< the low 32 bits of the number 22 uint32_t fLo; //!< the low 32 bits of the number
21 23
22 public: 24 public:
23 int32_t hi() const { return fHi; } 25 int32_t hi() const { return fHi; }
24 uint32_t lo() const { return fLo; } 26 uint32_t lo() const { return fLo; }
25 27
26 int64_t as64() const { return ((int64_t)fHi << 32) | fLo; } 28 int64_t as64() const { return ((int64_t)fHi << 32) | fLo; }
27 int64_t getLongLong() const { return this->as64(); } 29 int64_t getLongLong() const { return this->as64(); }
28 30
29 void set64(int64_t value) {
30 fHi = (int32_t)(value >> 32);
31 fLo = (uint32_t)value;
32 }
33
34 /** 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
35 */ 32 */
36 SkBool is32() const { return fHi == ((int32_t)fLo >> 31); } 33 SkBool is32() const { return fHi == ((int32_t)fLo >> 31); }
37 34
38 /** 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
39 */ 36 */
40 SkBool is64() const { return fHi != ((int32_t)fLo >> 31); } 37 SkBool is64() const { return fHi != ((int32_t)fLo >> 31); }
41 38
42 /** 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.
43 */ 40 */
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 175
179 friend bool operator>=(const Sk64& a, const Sk64& b) { 176 friend bool operator>=(const Sk64& a, const Sk64& b) {
180 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);
181 } 178 }
182 179
183 // Private to unittests. Parameter is (skiatest::Reporter*) 180 // Private to unittests. Parameter is (skiatest::Reporter*)
184 static void UnitTestWithReporter(void* skiatest_reporter); 181 static void UnitTestWithReporter(void* skiatest_reporter);
185 }; 182 };
186 183
187 #endif 184 #endif
OLDNEW
« no previous file with comments | « no previous file | include/core/SkBitmap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698