include/core/SkMath.h File Reference

#include "SkTypes.h"
Include dependency graph for SkMath.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define SkSqrt32(n)   SkSqrtBits(n, 15)
#define SkExtractSign(n)   ((int32_t)(n) >> 31)
#define SkCLZ(x)   SkCLZ_portable(x)
#define SkMulS16(x, y)   ((x) * (y))

Functions

int SkCLZ_portable (uint32_t)
 Returns the number of leading zero bits (0...32).
int32_t SkMulShift (int32_t a, int32_t b, unsigned shift)
int32_t SkMulDiv (int32_t numer1, int32_t numer2, int32_t denom)
int32_t SkDivBits (int32_t numer, int32_t denom, int shift)
int32_t SkSqrtBits (int32_t value, int bitBias)
int32_t SkCubeRootBits (int32_t value, int bitBias)

Define Documentation

#define SkCLZ (  )     SkCLZ_portable(x)

Definition at line 132 of file SkMath.h.

#define SkExtractSign (  )     ((int32_t)(n) >> 31)

Returns -1 if n < 0, else returns 0

Definition at line 57 of file SkMath.h.

#define SkMulS16 ( x,
 )     ((x) * (y))

SkMulS16(a, b) multiplies a * b, but requires that a and b are both int16_t. With this requirement, we can generate faster instructions on some architectures.

Definition at line 187 of file SkMath.h.

#define SkSqrt32 (  )     SkSqrtBits(n, 15)

Return the integer square root of n, treated as a SkFixed (16.16)

Definition at line 49 of file SkMath.h.


Function Documentation

int SkCLZ_portable ( uint32_t   ) 

Returns the number of leading zero bits (0...32).

int32_t SkCubeRootBits ( int32_t  value,
int  bitBias 
)

Return the integer cube root of value, with a bias of bitBias

int32_t SkDivBits ( int32_t  numer,
int32_t  denom,
int  shift 
)

Computes (numer1 << shift) / denom in full 64 intermediate precision. It is an error for denom to be 0. There is no special handling if the result overflows 32bits.

int32_t SkMulDiv ( int32_t  numer1,
int32_t  numer2,
int32_t  denom 
)

Computes numer1 * numer2 / denom in full 64 intermediate precision. It is an error for denom to be 0. There is no special handling if the result overflows 32bits.

int32_t SkMulShift ( int32_t  a,
int32_t  b,
unsigned  shift 
)

Computes the 64bit product of a * b, and then shifts the answer down by shift bits, returning the low 32bits. shift must be [0..63] e.g. to perform a fixedmul, call SkMulShift(a, b, 16)

int32_t SkSqrtBits ( int32_t  value,
int  bitBias 
)

Return the integer square root of value, with a bias of bitBias


Generated on Tue Oct 20 11:03:40 2009 for Skia by  doxygen 1.6.1