Lines Matching refs:value

14  *  Return the integer square root of value, with a bias of bitBias
16 int32_t SkSqrtBits(int32_t value, int bitBias);
23 * Returns (value < 0 ? 0 : value) efficiently (i.e. no compares or branches)
25 static inline int SkClampPos(int value) {
26 return value & ~(value >> 31);
68 /** Given a positive value and a positive max, return the value
70 Note: only works as long as max - value doesn't wrap around
71 @return max if value >= max, else value
73 static inline unsigned SkClampUMax(unsigned value, unsigned max) {
74 if (value > max) {
75 value = max;
77 return value;
82 // value back). So we create this helper function that casts to size_t (unsigned) first,
84 static inline size_t sk_negate_to_size_t(int32_t value) {
89 return -static_cast<size_t>(value);
117 /** Just the rounding step in SkDiv255Round: round(value / 255)
125 * Swap byte order of a 4-byte value, e.g. 0xaarrggbb -> 0xbbggrraa.
217 * Returns the log2 of the specified value, were that value to be rounded up
225 static inline int SkNextLog2(uint32_t value) {
226 SkASSERT(value != 0);
227 return 32 - SkCLZ(value - 1);
230 constexpr int SkNextLog2_portable(uint32_t value) {
231 SkASSERT(value != 0);
232 return 32 - SkCLZ_portable(value - 1);
236 * Returns the log2 of the specified value, were that value to be rounded down
244 static inline int SkPrevLog2(uint32_t value) {
245 SkASSERT(value != 0);
246 return 32 - SkCLZ(value >> 1);
249 constexpr int SkPrevLog2_portable(uint32_t value) {
250 SkASSERT(value != 0);
251 return 32 - SkCLZ_portable(value >> 1);
255 * Returns the smallest power-of-2 that is >= the specified value. If value
257 * if value is <= 0.
259 static inline int SkNextPow2(int value) {
260 SkASSERT(value > 0);
261 return 1 << SkNextLog2(value);
264 constexpr int SkNextPow2_portable(int value) {
265 SkASSERT(value > 0);
266 return 1 << SkNextLog2_portable(value);
270 * Returns the largest power-of-2 that is <= the specified value. If value
272 * if value is <= 0.
274 static inline int SkPrevPow2(int value) {
275 SkASSERT(value > 0);
276 return 1 << SkPrevLog2(value);
279 constexpr int SkPrevPow2_portable(int value) {
280 SkASSERT(value > 0);
281 return 1 << SkPrevLog2_portable(value);