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

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

Issue 1714623002: [fusl] clang-format fusl (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: headers too Created 4 years, 10 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
OLDNEW
1 #include "libm.h" 1 #include "libm.h"
2 2
3 double trunc(double x) 3 double trunc(double x) {
4 { 4 union {
5 » union {double f; uint64_t i;} u = {x}; 5 double f;
6 » int e = (int)(u.i >> 52 & 0x7ff) - 0x3ff + 12; 6 uint64_t i;
7 » uint64_t m; 7 } u = {x};
8 int e = (int)(u.i >> 52 & 0x7ff) - 0x3ff + 12;
9 uint64_t m;
8 10
9 » if (e >= 52 + 12) 11 if (e >= 52 + 12)
10 » » return x; 12 return x;
11 » if (e < 12) 13 if (e < 12)
12 » » e = 1; 14 e = 1;
13 » m = -1ULL >> e; 15 m = -1ULL >> e;
14 » if ((u.i & m) == 0) 16 if ((u.i & m) == 0)
15 » » return x; 17 return x;
16 » FORCE_EVAL(x + 0x1p120f); 18 FORCE_EVAL(x + 0x1p120f);
17 » u.i &= ~m; 19 u.i &= ~m;
18 » return u.f; 20 return u.f;
19 } 21 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698