diff options
author | Petr Hosek <phosek@chromium.org> | 2019-04-28 22:47:49 +0000 |
---|---|---|
committer | Petr Hosek <phosek@chromium.org> | 2019-04-28 22:47:49 +0000 |
commit | f0745e8476f069296a7c71accedd061dce4cdf79 (patch) | |
tree | 80b7eb5ce1c34cc11ef4cea79537a51a54ca4e45 /lib/builtins/floatundisf.c | |
parent | db42a0ccf35e49df3a801d4a7964fce06f587542 (diff) | |
download | compiler-rt-f0745e8476f069296a7c71accedd061dce4cdf79.tar.gz |
[builtins] Use single line C++/C99 comment style
Use the uniform single line C++/99 style for code comments.
This is part of the cleanup proposed in "[RFC] compiler-rt builtins
cleanup and refactoring".
Differential Revision: https://reviews.llvm.org/D60352
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@359411 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/builtins/floatundisf.c')
-rw-r--r-- | lib/builtins/floatundisf.c | 69 |
1 files changed, 33 insertions, 36 deletions
diff --git a/lib/builtins/floatundisf.c b/lib/builtins/floatundisf.c index a57dc47dd..03b1483a3 100644 --- a/lib/builtins/floatundisf.c +++ b/lib/builtins/floatundisf.c @@ -1,23 +1,21 @@ -/*===-- floatundisf.c - Implement __floatundisf ---------------------------=== - * - * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. - * See https://llvm.org/LICENSE.txt for license information. - * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - * - * ===----------------------------------------------------------------------=== - * - * This file implements __floatundisf for the compiler_rt library. - * - *===----------------------------------------------------------------------=== - */ +//===-- floatundisf.c - Implement __floatundisf ---------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file implements __floatundisf for the compiler_rt library. +// +//===----------------------------------------------------------------------===// -/* Returns: convert a to a float, rounding toward even. */ +// Returns: convert a to a float, rounding toward even. -/* Assumption: float is a IEEE 32 bit floating point type - * du_int is a 64 bit integral type - */ +// Assumption: float is a IEEE 32 bit floating point type +// du_int is a 64 bit integral type -/* seee eeee emmm mmmm mmmm mmmm mmmm mmmm */ +// seee eeee emmm mmmm mmmm mmmm mmmm mmmm #include "int_lib.h" @@ -25,17 +23,16 @@ COMPILER_RT_ABI float __floatundisf(du_int a) { if (a == 0) return 0.0F; const unsigned N = sizeof(du_int) * CHAR_BIT; - int sd = N - __builtin_clzll(a); /* number of significant digits */ - int e = sd - 1; /* 8 exponent */ + int sd = N - __builtin_clzll(a); // number of significant digits + int e = sd - 1; // 8 exponent if (sd > FLT_MANT_DIG) { - /* start: 0000000000000000000001xxxxxxxxxxxxxxxxxxxxxxPQxxxxxxxxxxxxxxxxxx - * finish: 000000000000000000000000000000000000001xxxxxxxxxxxxxxxxxxxxxxPQR - * 12345678901234567890123456 - * 1 = msb 1 bit - * P = bit FLT_MANT_DIG-1 bits to the right of 1 - * Q = bit FLT_MANT_DIG bits to the right of 1 - * R = "or" of all bits to the right of Q - */ + // start: 0000000000000000000001xxxxxxxxxxxxxxxxxxxxxxPQxxxxxxxxxxxxxxxxxx + // finish: 000000000000000000000000000000000000001xxxxxxxxxxxxxxxxxxxxxxPQR + // 12345678901234567890123456 + // 1 = msb 1 bit + // P = bit FLT_MANT_DIG-1 bits to the right of 1 + // Q = bit FLT_MANT_DIG bits to the right of 1 + // R = "or" of all bits to the right of Q switch (sd) { case FLT_MANT_DIG + 1: a <<= 1; @@ -46,23 +43,23 @@ COMPILER_RT_ABI float __floatundisf(du_int a) { a = (a >> (sd - (FLT_MANT_DIG + 2))) | ((a & ((du_int)(-1) >> ((N + FLT_MANT_DIG + 2) - sd))) != 0); }; - /* finish: */ - a |= (a & 4) != 0; /* Or P into R */ - ++a; /* round - this step may add a significant bit */ - a >>= 2; /* dump Q and R */ - /* a is now rounded to FLT_MANT_DIG or FLT_MANT_DIG+1 bits */ + // finish: + a |= (a & 4) != 0; // Or P into R + ++a; // round - this step may add a significant bit + a >>= 2; // dump Q and R + // a is now rounded to FLT_MANT_DIG or FLT_MANT_DIG+1 bits if (a & ((du_int)1 << FLT_MANT_DIG)) { a >>= 1; ++e; } - /* a is now rounded to FLT_MANT_DIG bits */ + // a is now rounded to FLT_MANT_DIG bits } else { a <<= (FLT_MANT_DIG - sd); - /* a is now rounded to FLT_MANT_DIG bits */ + // a is now rounded to FLT_MANT_DIG bits } float_bits fb; - fb.u = ((e + 127) << 23) | /* exponent */ - ((su_int)a & 0x007FFFFF); /* mantissa */ + fb.u = ((e + 127) << 23) | // exponent + ((su_int)a & 0x007FFFFF); // mantissa return fb.f; } |