Skia
2D Graphics Library
SkMath.h File Reference
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.

Functions

static int64_t sk_64_mul (int64_t a, int64_t b)
 
template<typename T >
constexpr bool SkIsPow2 (T value)
 Returns true if value is a power of 2. More...
 
static unsigned SkMul16ShiftRound (U16CPU a, U16CPU b, int shift)
 Return a*b/((1 << shift) - 1), rounding any fractional bits. More...
 
static U8CPU SkMulDiv255Round (U16CPU a, U16CPU b)
 Return a*b/255, rounding any fractional bits. More...
 

Function Documentation

◆ sk_64_mul()

static int64_t sk_64_mul ( int64_t  a,
int64_t  b 
)
inlinestatic

◆ SkIsPow2()

template<typename T >
constexpr bool SkIsPow2 ( value)
inlineconstexpr

Returns true if value is a power of 2.

Does not explicitly check for value <= 0.

◆ SkMul16ShiftRound()

static unsigned SkMul16ShiftRound ( U16CPU  a,
U16CPU  b,
int  shift 
)
inlinestatic

Return a*b/((1 << shift) - 1), rounding any fractional bits.

Only valid if a and b are unsigned and <= 32767 and shift is > 0 and <= 8

◆ SkMulDiv255Round()

static U8CPU SkMulDiv255Round ( U16CPU  a,
U16CPU  b 
)
inlinestatic

Return a*b/255, rounding any fractional bits.

Only valid if a and b are unsigned and <= 32767.