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

Unified Diff: fusl/src/math/scalbn.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 side-by-side diff with in-line comments
Download patch
Index: fusl/src/math/scalbn.c
diff --git a/fusl/src/math/scalbn.c b/fusl/src/math/scalbn.c
index 530e07c79f051aab246f39b31bfa1571699a8f57..acfc13df6fc109e66a6472ecc21e6f494e9402b9 100644
--- a/fusl/src/math/scalbn.c
+++ b/fusl/src/math/scalbn.c
@@ -1,31 +1,33 @@
#include <math.h>
#include <stdint.h>
-double scalbn(double x, int n)
-{
- union {double f; uint64_t i;} u;
- double_t y = x;
+double scalbn(double x, int n) {
+ union {
+ double f;
+ uint64_t i;
+ } u;
+ double_t y = x;
- if (n > 1023) {
- y *= 0x1p1023;
- n -= 1023;
- if (n > 1023) {
- y *= 0x1p1023;
- n -= 1023;
- if (n > 1023)
- n = 1023;
- }
- } else if (n < -1022) {
- y *= 0x1p-1022;
- n += 1022;
- if (n < -1022) {
- y *= 0x1p-1022;
- n += 1022;
- if (n < -1022)
- n = -1022;
- }
- }
- u.i = (uint64_t)(0x3ff+n)<<52;
- x = y * u.f;
- return x;
+ if (n > 1023) {
+ y *= 0x1p1023;
+ n -= 1023;
+ if (n > 1023) {
+ y *= 0x1p1023;
+ n -= 1023;
+ if (n > 1023)
+ n = 1023;
+ }
+ } else if (n < -1022) {
+ y *= 0x1p-1022;
+ n += 1022;
+ if (n < -1022) {
+ y *= 0x1p-1022;
+ n += 1022;
+ if (n < -1022)
+ n = -1022;
+ }
+ }
+ u.i = (uint64_t)(0x3ff + n) << 52;
+ x = y * u.f;
+ return x;
}

Powered by Google App Engine
This is Rietveld 408576698