зеркало из https://github.com/mozilla/moz-skia.git
remove unused SkIntToFloatCast_NoOverflowCheck
R=reed@google.com, reed BUG=skia:2849 Author: caryclark@google.com Review URL: https://codereview.chromium.org/483273003
This commit is contained in:
Родитель
3ba54fa0ad
Коммит
38dd9f2e41
|
@ -95,7 +95,6 @@ static inline float Sk2sComplimentAsFloat(int32_t x) {
|
|||
/** Return x cast to a float (i.e. (float)x)
|
||||
*/
|
||||
float SkIntToFloatCast(int x);
|
||||
float SkIntToFloatCast_NoOverflowCheck(int x);
|
||||
|
||||
/** Return the float cast to an int.
|
||||
If the value is out of range, or NaN, return +/- SK_MaxS32
|
||||
|
|
|
@ -203,23 +203,3 @@ float SkIntToFloatCast(int32_t value) {
|
|||
data.fSignBitInt = (sign << 31) | (shift << 23) | (value & ~MATISSA_MAGIC_BIG);
|
||||
return data.fFloat;
|
||||
}
|
||||
|
||||
float SkIntToFloatCast_NoOverflowCheck(int32_t value) {
|
||||
if (0 == value) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int shift = EXP_BIAS;
|
||||
|
||||
// record the sign and make value positive
|
||||
int sign = SkExtractSign(value);
|
||||
value = SkApplySign(value, sign);
|
||||
|
||||
int zeros = SkCLZ(value << 8);
|
||||
value <<= zeros;
|
||||
shift -= zeros;
|
||||
|
||||
SkFloatIntUnion data;
|
||||
data.fSignBitInt = (sign << 31) | (shift << 23) | (value & ~MATISSA_MAGIC_BIG);
|
||||
return data.fFloat;
|
||||
}
|
||||
|
|
|
@ -264,9 +264,7 @@ static void test_float_conversions(skiatest::Reporter* reporter, float x) {
|
|||
static void test_int2float(skiatest::Reporter* reporter, int ival) {
|
||||
float x0 = (float)ival;
|
||||
float x1 = SkIntToFloatCast(ival);
|
||||
float x2 = SkIntToFloatCast_NoOverflowCheck(ival);
|
||||
REPORTER_ASSERT(reporter, x0 == x1);
|
||||
REPORTER_ASSERT(reporter, x0 == x2);
|
||||
}
|
||||
|
||||
static void unittest_fastfloat(skiatest::Reporter* reporter) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче