Sk64 Class Reference
#include <Sk64.h>
List of all members.
Public Types |
enum | DivOptions { kTrunc_DivOption,
kRound_DivOption
} |
Public Member Functions |
SkBool | is32 () const |
SkBool | is64 () const |
SkBool | isFixed () const |
int32_t | get32 () const |
SkFixed | getFixed () const |
SkFract | getFract () const |
int32_t | getSqrt () const |
int | getClzAbs () const |
SkBool | isZero () const |
SkBool | nonZero () const |
SkBool | isNeg () const |
SkBool | isPos () const |
int | getSign () const |
void | negate () |
void | abs () |
int | shiftToMake32 () const |
void | setZero () |
void | set (int32_t hi, uint32_t lo) |
void | set (int32_t a) |
void | setMul (int32_t a, int32_t b) |
int32_t | getShiftRight (unsigned bitCount) const |
void | shiftLeft (unsigned bits) |
void | shiftRight (unsigned bits) |
void | roundRight (unsigned bits) |
void | add (int32_t lo) |
void | add (int32_t hi, uint32_t lo) |
void | add (const Sk64 &other) |
void | sub (const Sk64 &num) |
void | rsub (const Sk64 &num) |
void | mul (int32_t) |
void | div (int32_t, DivOptions) |
SkFixed | addGetFixed (const Sk64 &other) const |
SkFixed | addGetFixed (int32_t hi, uint32_t lo) const |
SkFixed | getFixedDiv (const Sk64 &denom) const |
Public Attributes |
int32_t | fHi |
| the high 32 bits of the number (including sign)
|
uint32_t | fLo |
| the low 32 bits of the number
|
Friends |
bool | operator== (const Sk64 &a, const Sk64 &b) |
bool | operator!= (const Sk64 &a, const Sk64 &b) |
bool | operator< (const Sk64 &a, const Sk64 &b) |
bool | operator<= (const Sk64 &a, const Sk64 &b) |
bool | operator> (const Sk64 &a, const Sk64 &b) |
bool | operator>= (const Sk64 &a, const Sk64 &b) |
Detailed Description
Sk64 is a 64-bit math package that does not require long long support from the compiler.
Definition at line 27 of file Sk64.h.
Member Enumeration Documentation
- Enumerator:
kTrunc_DivOption |
truncate the result when calling div()
|
kRound_DivOption |
round the result when calling div()
|
Definition at line 169 of file Sk64.h.
Member Function Documentation
If the number < 0, negate the number
void Sk64::add |
( |
const Sk64 & |
other |
) |
[inline] |
Add the specified Sk64 to the number
Definition at line 155 of file Sk64.h.
void Sk64::add |
( |
int32_t |
hi, |
|
|
uint32_t |
lo | |
|
) |
| | [inline] |
Add the specified Sk64 to the number
Definition at line 147 of file Sk64.h.
void Sk64::add |
( |
int32_t |
lo |
) |
[inline] |
Add the specified 32 bit integer to the number
Definition at line 138 of file Sk64.h.
SkFixed Sk64::addGetFixed |
( |
int32_t |
hi, |
|
|
uint32_t |
lo | |
|
) |
| | const [inline] |
return (this + Sk64(hi, lo) >> 16) as a 32bit result
Definition at line 185 of file Sk64.h.
SkFixed Sk64::addGetFixed |
( |
const Sk64 & |
other |
) |
const [inline] |
return (this + other >> 16) as a 32bit result
Definition at line 180 of file Sk64.h.
Divide the number by the specified 32 bit integer, using the specified divide option (either truncate or round).
int32_t Sk64::get32 |
( |
|
) |
const [inline] |
Return the signed 32 bit integer equivalent. Asserts that is32() returns non-zero.
Definition at line 46 of file Sk64.h.
int Sk64::getClzAbs |
( |
|
) |
const |
Returns the number of leading zeros of the absolute value of this. Will return in the range [0..64]
SkFixed Sk64::getFixed |
( |
|
) |
const [inline] |
Return the number >> 16. Asserts that this does not loose any significant high bits.
Definition at line 50 of file Sk64.h.
Return the result of dividing the number by denom, treating the answer as a SkFixed. (*this) << 16 / denom. It is an error for denom to be 0.
Return the number >> 30. Asserts that this does not loose any significant high bits.
int32_t Sk64::getShiftRight |
( |
unsigned |
bitCount |
) |
const |
extract 32bits after shifting right by bitCount. Note: itCount must be [0..63]. Asserts that no significant high bits were lost.
int Sk64::getSign |
( |
|
) |
const [inline] |
Returns -1,0,+1 based on the sign of the number
Definition at line 87 of file Sk64.h.
int32_t Sk64::getSqrt |
( |
|
) |
const |
Returns the square-root of the number as a signed 32 bit value.
SkBool Sk64::is32 |
( |
|
) |
const [inline] |
Returns non-zero if the Sk64 can be represented as a signed 32 bit integer
Definition at line 33 of file Sk64.h.
SkBool Sk64::is64 |
( |
|
) |
const [inline] |
Returns non-zero if the Sk64 cannot be represented as a signed 32 bit integer
Definition at line 37 of file Sk64.h.
SkBool Sk64::isFixed |
( |
|
) |
const |
Returns non-zero if the Sk64 can be represented as a signed 48 bit integer. Used to know if we can shift the value down by 16 to treat it as a SkFixed.
SkBool Sk64::isNeg |
( |
|
) |
const [inline] |
Returns non-zero if the number is negative (number < 0)
Definition at line 81 of file Sk64.h.
SkBool Sk64::isPos |
( |
|
) |
const [inline] |
Returns non-zero if the number is positive (number > 0)
Definition at line 84 of file Sk64.h.
SkBool Sk64::isZero |
( |
|
) |
const [inline] |
Returns non-zero if the number is zero
Definition at line 75 of file Sk64.h.
void Sk64::mul |
( |
int32_t |
|
) |
|
Multiply the number by the specified 32 bit integer
SkBool Sk64::nonZero |
( |
|
) |
const [inline] |
Returns non-zero if the number is non-zero
Definition at line 78 of file Sk64.h.
void Sk64::roundRight |
( |
unsigned |
bits |
) |
|
Shift the number right by the specified number of bits, but round the result.
- Parameters:
-
| bits | How far to shift right, must be [0..63]. This performs an arithmetic right-shift (sign extending). |
void Sk64::rsub |
( |
const Sk64 & |
num |
) |
|
Subtract the number from the specified Sk64. (*this) = num - (*this)
void Sk64::set |
( |
int32_t |
a |
) |
[inline] |
Set the number to the specified 32 bit integer
Definition at line 108 of file Sk64.h.
void Sk64::set |
( |
int32_t |
hi, |
|
|
uint32_t |
lo | |
|
) |
| | [inline] |
Set the high and low 32 bit values of the number
Definition at line 105 of file Sk64.h.
void Sk64::setMul |
( |
int32_t |
a, |
|
|
int32_t |
b | |
|
) |
| | |
Set the number to the product of the two 32 bit integers
void Sk64::setZero |
( |
|
) |
[inline] |
Set the number to zero
Definition at line 102 of file Sk64.h.
void Sk64::shiftLeft |
( |
unsigned |
bits |
) |
|
Shift the number left by the specified number of bits.
- Parameters:
-
| bits | How far to shift left, must be [0..63] |
void Sk64::shiftRight |
( |
unsigned |
bits |
) |
|
Shift the number right by the specified number of bits.
- Parameters:
-
| bits | How far to shift right, must be [0..63]. This performs an arithmetic right-shift (sign extending). |
int Sk64::shiftToMake32 |
( |
|
) |
const |
Returns the number of bits needed to shift the Sk64 to the right in order to make it fit in a signed 32 bit integer.
void Sk64::sub |
( |
const Sk64 & |
num |
) |
|
Subtract the specified Sk64 from the number. (*this) = (*this) - num
Friends And Related Function Documentation
bool operator!= |
( |
const Sk64 & |
a, |
|
|
const Sk64 & |
b | |
|
) |
| | [friend] |
bool operator< |
( |
const Sk64 & |
a, |
|
|
const Sk64 & |
b | |
|
) |
| | [friend] |
bool operator<= |
( |
const Sk64 & |
a, |
|
|
const Sk64 & |
b | |
|
) |
| | [friend] |
bool operator== |
( |
const Sk64 & |
a, |
|
|
const Sk64 & |
b | |
|
) |
| | [friend] |
bool operator> |
( |
const Sk64 & |
a, |
|
|
const Sk64 & |
b | |
|
) |
| | [friend] |
bool operator>= |
( |
const Sk64 & |
a, |
|
|
const Sk64 & |
b | |
|
) |
| | [friend] |
Member Data Documentation
the high 32 bits of the number (including sign)
Definition at line 28 of file Sk64.h.
the low 32 bits of the number
Definition at line 29 of file Sk64.h.
The documentation for this class was generated from the following file: