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

Side by Side Diff: fusl/src/math/truncf.c

Issue 1573973002: Add a "fork" of musl as //fusl. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 11 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 | « fusl/src/math/trunc.c ('k') | fusl/src/math/truncl.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #include "libm.h"
2
3 float truncf(float x)
4 {
5 union {float f; uint32_t i;} u = {x};
6 int e = (int)(u.i >> 23 & 0xff) - 0x7f + 9;
7 uint32_t m;
8
9 if (e >= 23 + 9)
10 return x;
11 if (e < 9)
12 e = 1;
13 m = -1U >> e;
14 if ((u.i & m) == 0)
15 return x;
16 FORCE_EVAL(x + 0x1p120f);
17 u.i &= ~m;
18 return u.f;
19 }
OLDNEW
« no previous file with comments | « fusl/src/math/trunc.c ('k') | fusl/src/math/truncl.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698