Lines Matching full:value
43 /** Return the integer square root of value, with a bias of bitBias
45 int32_t SkSqrtBits(int32_t value, int bitBias);
51 /** Return the integer cube root of value, with a bias of bitBias
53 int32_t SkCubeRootBits(int32_t value, int bitBias);
72 /** Returns (value < 0 ? 0 : value) efficiently (i.e. no compares or branches)
74 static inline int SkClampPos(int value) {
75 return value & ~(value >> 31);
78 /** Given an integer and a positive (max) integer, return the value
80 Note: only works as long as max - value doesn't wrap around
81 @param value The value we want returned pinned between [0...max]
82 @param max The positive max value
83 @return 0 if value < 0, max if value > max, else value
85 static inline int SkClampMax(int value, int max) {
88 // ensure that if value is negative, max - value doesn't wrap around
89 SkASSERT(value >= 0 || max - value > 0);
92 if (value < 0) {
93 value = 0;
95 if (value > max) {
96 value = max;
98 return value;
101 int diff = max - value;
105 // clear the result if value < 0
106 return (value + diff) & ~(value >> 31);
110 /** Given a positive value and a positive max, return the value
112 Note: only works as long as max - value doesn't wrap around
113 @return max if value >= max, else value
115 static inline unsigned SkClampUMax(unsigned value, unsigned max) {
117 if (value > max) {
118 value = max;
120 return value;
122 int diff = max - value;
126 return value + diff;
142 /** Returns the smallest power-of-2 that is >= the specified value. If value
144 if value is <= 0.
146 static inline int SkNextPow2(int value) {
147 SkASSERT(value > 0);
148 return 1 << (32 - SkCLZ(value - 1));
151 /** Returns the log2 of the specified value, were that value to be rounded up
159 static inline int SkNextLog2(uint32_t value) {
160 SkASSERT(value != 0);
161 return 32 - SkCLZ(value - 1);
227 /** Just the rounding step in SkDiv255Round: round(value / 255)