Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: src/core/SkFloatBits.cpp

Issue 483273003: remove unused SkIntToFloatCast_NoOverflowCheck (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/core/SkFloatBits.h ('k') | tests/MathTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkFloatBits.h" 8 #include "SkFloatBits.h"
9 #include "SkMathPriv.h" 9 #include "SkMathPriv.h"
10 10
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 } 196 }
197 197
198 // now value is left-aligned to 24 bits 198 // now value is left-aligned to 24 bits
199 SkASSERT((value >> 23) == 1); 199 SkASSERT((value >> 23) == 1);
200 SkASSERT(shift >= 0 && shift <= 255); 200 SkASSERT(shift >= 0 && shift <= 255);
201 201
202 SkFloatIntUnion data; 202 SkFloatIntUnion data;
203 data.fSignBitInt = (sign << 31) | (shift << 23) | (value & ~MATISSA_MAGIC_BI G); 203 data.fSignBitInt = (sign << 31) | (shift << 23) | (value & ~MATISSA_MAGIC_BI G);
204 return data.fFloat; 204 return data.fFloat;
205 } 205 }
206
207 float SkIntToFloatCast_NoOverflowCheck(int32_t value) {
208 if (0 == value) {
209 return 0;
210 }
211
212 int shift = EXP_BIAS;
213
214 // record the sign and make value positive
215 int sign = SkExtractSign(value);
216 value = SkApplySign(value, sign);
217
218 int zeros = SkCLZ(value << 8);
219 value <<= zeros;
220 shift -= zeros;
221
222 SkFloatIntUnion data;
223 data.fSignBitInt = (sign << 31) | (shift << 23) | (value & ~MATISSA_MAGIC_BI G);
224 return data.fFloat;
225 }
OLDNEW
« no previous file with comments | « include/core/SkFloatBits.h ('k') | tests/MathTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698