summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward O'Callaghan <eocallaghan@auroraux.org>2009-08-05 19:06:50 +0000
committerEdward O'Callaghan <eocallaghan@auroraux.org>2009-08-05 19:06:50 +0000
commit1fcb40b79d8fbfcc9acb0966d5f9bba09431f832 (patch)
treefce65563d921b10e2ee3780b17a6b020e61afccf
parent2bf62728b8ce00e295c7bf0fb328427496cc85aa (diff)
downloadcompiler-rt-1fcb40b79d8fbfcc9acb0966d5f9bba09431f832.tar.gz
compiler-rt-1fcb40b79d8fbfcc9acb0966d5f9bba09431f832.tar.bz2
compiler-rt-1fcb40b79d8fbfcc9acb0966d5f9bba09431f832.tar.xz
Next batch of C++ to C comment style changes. Also improve and factor out endianness pre-processor code.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@78226 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/addvti3.c29
-rw-r--r--lib/ctzti2.c29
-rw-r--r--lib/endianness.h65
-rw-r--r--lib/fixsfti.c36
-rw-r--r--lib/fixunsxfsi.c44
-rw-r--r--lib/floatuntidf.c73
-rw-r--r--lib/floatuntisf.c71
-rw-r--r--lib/int_lib.h47
-rw-r--r--lib/mulvsi3.c29
-rw-r--r--lib/mulvti3.c29
-rw-r--r--lib/mulxc3.c27
-rw-r--r--lib/popcountdi2.c43
-rw-r--r--lib/powitf2.c27
-rw-r--r--lib/powixf2.c27
-rw-r--r--lib/ucmpti2.c32
-rw-r--r--lib/umodti3.c27
16 files changed, 339 insertions, 296 deletions
diff --git a/lib/addvti3.c b/lib/addvti3.c
index 5c87d3e8..afc3e3b9 100644
--- a/lib/addvti3.c
+++ b/lib/addvti3.c
@@ -1,24 +1,25 @@
-//===-- addvti3.c - Implement __addvti3 -----------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __addvti3 for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/* ===-- addvti3.c - Implement __addvti3 -----------------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __addvti3 for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
#if __x86_64
#include "int_lib.h"
#include <stdlib.h>
-// Returns: a + b
+/* Returns: a + b */
-// Effects: aborts if a + b overflows
+/* Effects: aborts if a + b overflows */
ti_int
__addvti3(ti_int a, ti_int b)
diff --git a/lib/ctzti2.c b/lib/ctzti2.c
index 828db266..fdfac0d4 100644
--- a/lib/ctzti2.c
+++ b/lib/ctzti2.c
@@ -1,23 +1,24 @@
-//===-- ctzti2.c - Implement __ctzti2 -------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __ctzti2 for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/* ===-- ctzti2.c - Implement __ctzti2 -------------------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __ctzti2 for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
#if __x86_64
#include "int_lib.h"
-// Returns: the number of trailing 0-bits
+/* Returns: the number of trailing 0-bits */
-// Precondition: a != 0
+/* Precondition: a != 0 */
si_int
__ctzti2(ti_int a)
diff --git a/lib/endianness.h b/lib/endianness.h
new file mode 100644
index 00000000..9e192c10
--- /dev/null
+++ b/lib/endianness.h
@@ -0,0 +1,65 @@
+/* ===-- endianness.h - configuration header for libgcc replacement --------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file is a configuration header for libgcc replacement.
+ * This file is not part of the interface of this library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
+
+#ifndef ENDIANNESS_H
+#define ENDIANNESS_H
+
+/* TODO: Improve this to minimal pre-processor hackish'ness. */
+/* config.h build via CMake. */
+/* #include <config.h> */
+/* Solaris header for endian and byte swap */
+/* #if defined HAVE_SYS_BYTEORDER_H */
+
+#if defined (__SVR4) && defined (__sun)
+#include <sys/byteorder.h>
+#if _BYTE_ORDER == _BIG_ENDIAN
+#define __BIG_ENDIAN__ 1
+#define __LITTLE_ENDIAN__ 0
+#else /* _BYTE_ORDER == _LITTLE_ENDIAN */
+#define __BIG_ENDIAN__ 0
+#define __LITTLE_ENDIAN__ 1
+#endif /* _BYTE_ORDER */
+#endif /* Solaris and AuroraUX. */
+
+#if defined (__FreeBSD__)
+#include <sys/endian.h>
+#if _BYTE_ORDER == _BIG_ENDIAN
+#define __BIG_ENDIAN__ 1
+#define __LITTLE_ENDIAN__ 0
+#else /* _BYTE_ORDER == _LITTLE_ENDIAN */
+#define __BIG_ENDIAN__ 0
+#define __LITTLE_ENDIAN__ 1
+#endif /* _BYTE_ORDER */
+#endif /* FreeBSD */
+
+#ifdef __LITTLE_ENDIAN__
+#if __LITTLE_ENDIAN__
+#define _YUGA_LITTLE_ENDIAN 1
+#define _YUGA_BIG_ENDIAN 0
+#endif
+#endif
+
+#ifdef __BIG_ENDIAN__
+#if __BIG_ENDIAN__
+#define _YUGA_LITTLE_ENDIAN 0
+#define _YUGA_BIG_ENDIAN 1
+#endif
+#endif
+
+#if !defined(_YUGA_LITTLE_ENDIAN) || !defined(_YUGA_BIG_ENDIAN)
+#error unable to determine endian
+#endif
+
+#endif /* ENDIANNESS_H */
diff --git a/lib/fixsfti.c b/lib/fixsfti.c
index 8e395875..95992fe3 100644
--- a/lib/fixsfti.c
+++ b/lib/fixsfti.c
@@ -1,27 +1,29 @@
-//===-- fixsfti.c - Implement __fixsfti -----------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __fixsfti for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/* ===-- fixsfti.c - Implement __fixsfti -----------------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __fixsfti for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
#if __x86_64
#include "int_lib.h"
-// Returns: convert a to a signed long long, rounding toward zero.
+/* Returns: convert a to a signed long long, rounding toward zero. */
-// Assumption: float is a IEEE 32 bit floating point type
-// su_int is a 32 bit integral type
-// value in float is representable in ti_int (no range checking performed)
+/* Assumption: float is a IEEE 32 bit floating point type
+ * su_int is a 32 bit integral type
+ * value in float is representable in ti_int (no range checking performed)
+ */
-// seee eeee emmm mmmm mmmm mmmm mmmm mmmm
+/* seee eeee emmm mmmm mmmm mmmm mmmm mmmm */
ti_int
__fixsfti(float a)
diff --git a/lib/fixunsxfsi.c b/lib/fixunsxfsi.c
index 2c186a68..a711a26e 100644
--- a/lib/fixunsxfsi.c
+++ b/lib/fixunsxfsi.c
@@ -1,30 +1,34 @@
-//===-- fixunsxfsi.c - Implement __fixunsxfsi -----------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __fixunsxfsi for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/* ===-- fixunsxfsi.c - Implement __fixunsxfsi -----------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __fixunsxfsi for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
#if !_ARCH_PPC
#include "int_lib.h"
-// Returns: convert a to a unsigned int, rounding toward zero.
-// Negative values all become zero.
+/* Returns: convert a to a unsigned int, rounding toward zero.
+ * Negative values all become zero.
+ */
-// Assumption: long double is an intel 80 bit floating point type padded with 6 bytes
-// su_int is a 32 bit integral type
-// value in long double is representable in su_int or is negative
-// (no range checking performed)
+/* Assumption: long double is an intel 80 bit floating point type padded with 6 bytes
+ * su_int is a 32 bit integral type
+ * value in long double is representable in su_int or is negative
+ * (no range checking performed)
+ */
-// gggg gggg gggg gggg gggg gggg gggg gggg | gggg gggg gggg gggg seee eeee eeee eeee |
-// 1mmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm
+/* gggg gggg gggg gggg gggg gggg gggg gggg | gggg gggg gggg gggg seee eeee eeee eeee |
+ * 1mmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm
+ */
su_int
__fixunsxfsi(long double a)
diff --git a/lib/floatuntidf.c b/lib/floatuntidf.c
index 1b87fcfc..2e8369e9 100644
--- a/lib/floatuntidf.c
+++ b/lib/floatuntidf.c
@@ -1,27 +1,29 @@
-//===-- floatuntidf.c - Implement __floatuntidf ---------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __floatuntidf for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/* ===-- floatuntidf.c - Implement __floatuntidf ---------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __floatuntidf for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
#if __x86_64
#include "int_lib.h"
#include <float.h>
-// Returns: convert a to a double, rounding toward even.
+/* Returns: convert a to a double, rounding toward even. */
-// Assumption: double is a IEEE 64 bit floating point type
-// tu_int is a 128 bit integral type
+/* Assumption: double is a IEEE 64 bit floating point type
+ * tu_int is a 128 bit integral type
+ */
-// seee eeee eeee mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm
+/* seee eeee eeee mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm */
si_int __clzti2(ti_int a);
@@ -31,17 +33,18 @@ __floatuntidf(tu_int a)
if (a == 0)
return 0.0;
const unsigned N = sizeof(tu_int) * CHAR_BIT;
- int sd = N - __clzti2(a); // number of significant digits
- int e = sd - 1; // exponent
+ int sd = N - __clzti2(a); /* number of significant digits */
+ int e = sd - 1; /* exponent */
if (sd > DBL_MANT_DIG)
{
- // start: 0000000000000000000001xxxxxxxxxxxxxxxxxxxxxxPQxxxxxxxxxxxxxxxxxx
- // finish: 000000000000000000000000000000000000001xxxxxxxxxxxxxxxxxxxxxxPQR
- // 12345678901234567890123456
- // 1 = msb 1 bit
- // P = bit DBL_MANT_DIG-1 bits to the right of 1
- // Q = bit DBL_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 DBL_MANT_DIG-1 bits to the right of 1
+ * Q = bit DBL_MANT_DIG bits to the right of 1
+ * R = "or" of all bits to the right of Q
+ */
switch (sd)
{
case DBL_MANT_DIG + 1:
@@ -53,27 +56,27 @@ __floatuntidf(tu_int a)
a = (a >> (sd - (DBL_MANT_DIG+2))) |
((a & ((tu_int)(-1) >> ((N + DBL_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 DBL_MANT_DIG or DBL_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 DBL_MANT_DIG or DBL_MANT_DIG+1 bits */
if (a & ((tu_int)1 << DBL_MANT_DIG))
{
a >>= 1;
++e;
}
- // a is now rounded to DBL_MANT_DIG bits
+ /* a is now rounded to DBL_MANT_DIG bits */
}
else
{
a <<= (DBL_MANT_DIG - sd);
- // a is now rounded to DBL_MANT_DIG bits
+ /* a is now rounded to DBL_MANT_DIG bits */
}
double_bits fb;
- fb.u.high = ((e + 1023) << 20) | // exponent
- ((su_int)(a >> 32) & 0x000FFFFF); // mantissa-high
- fb.u.low = (su_int)a; // mantissa-low
+ fb.u.high = ((e + 1023) << 20) | /* exponent */
+ ((su_int)(a >> 32) & 0x000FFFFF); /* mantissa-high */
+ fb.u.low = (su_int)a; /* mantissa-low */
return fb.f;
}
diff --git a/lib/floatuntisf.c b/lib/floatuntisf.c
index e75d9957..328f39bb 100644
--- a/lib/floatuntisf.c
+++ b/lib/floatuntisf.c
@@ -1,27 +1,29 @@
-//===-- floatuntisf.c - Implement __floatuntisf ---------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __floatuntisf for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/* ===-- floatuntisf.c - Implement __floatuntisf ---------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __floatuntisf for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
#if __x86_64
#include "int_lib.h"
#include <float.h>
-// 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
-// tu_int is a 128 bit integral type
+/* Assumption: float is a IEEE 32 bit floating point type
+ * tu_int is a 128 bit integral type
+ */
-// seee eeee emmm mmmm mmmm mmmm mmmm mmmm
+/* seee eeee emmm mmmm mmmm mmmm mmmm mmmm */
si_int __clzti2(ti_int a);
@@ -31,17 +33,18 @@ __floatuntisf(tu_int a)
if (a == 0)
return 0.0F;
const unsigned N = sizeof(tu_int) * CHAR_BIT;
- int sd = N - __clzti2(a); // number of significant digits
- int e = sd - 1; // exponent
+ int sd = N - __clzti2(a); /* number of significant digits */
+ int e = sd - 1; /* 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:
@@ -53,26 +56,26 @@ __floatuntisf(tu_int a)
a = (a >> (sd - (FLT_MANT_DIG+2))) |
((a & ((tu_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 & ((tu_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;
}
diff --git a/lib/int_lib.h b/lib/int_lib.h
index 6ef7b8e3..2557244c 100644
--- a/lib/int_lib.h
+++ b/lib/int_lib.h
@@ -20,58 +20,13 @@
/* Assumption: right shift of signed negative is arithmetic shift */
#include <limits.h>
+#include "endianness.h"
#include <math.h>
#if !defined(INFINITY) && defined(HUGE_VAL)
#define INFINITY HUGE_VAL
#endif
-/* TODO: Improve this to minimal pre-processor hackish'ness. */
-#if defined (__SVR4) && defined (__sun)
-/* config.h build via CMake. */
-/* #include <config.h> */
-
-/* Solaris header for endian and byte swap */
-/* #if defined HAVE_SYS_BYTEORDER_H */
-#include <sys/byteorder.h>
-
-/* Solaris defines endian by setting _LITTLE_ENDIAN or _BIG_ENDIAN */
-#ifdef _BIG_ENDIAN
-# define IS_BIG_ENDIAN
-#endif
-#ifdef _LITTLE_ENDIAN
-# define IS_LITTLE_ENDIAN
-#endif
-
-#ifdef IS_BIG_ENDIAN
-#define __BIG_ENDIAN__ 1
-#define __LITTLE_ENDIAN__ 0
-#endif
-#ifdef IS_LITTLE_ENDIAN
-#define __BIG_ENDIAN__ 0
-#define __LITTLE_ENDIAN__ 1
-#endif
-
-#endif /* End of Solaris ifdef. */
-
-#ifdef __LITTLE_ENDIAN__
-#if __LITTLE_ENDIAN__
-#define _YUGA_LITTLE_ENDIAN 1
-#define _YUGA_BIG_ENDIAN 0
-#endif
-#endif
-
-#ifdef __BIG_ENDIAN__
-#if __BIG_ENDIAN__
-#define _YUGA_LITTLE_ENDIAN 0
-#define _YUGA_BIG_ENDIAN 1
-#endif
-#endif
-
-#if !defined(_YUGA_LITTLE_ENDIAN) || !defined(_YUGA_BIG_ENDIAN)
-#error unable to determine endian
-#endif
-
typedef int si_int;
typedef unsigned su_int;
diff --git a/lib/mulvsi3.c b/lib/mulvsi3.c
index cef0c355..9edeee2d 100644
--- a/lib/mulvsi3.c
+++ b/lib/mulvsi3.c
@@ -1,22 +1,23 @@
-//===-- mulvsi3.c - Implement __mulvsi3 -----------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __mulvsi3 for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/* ===-- mulvsi3.c - Implement __mulvsi3 -----------------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __mulvsi3 for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
#include "int_lib.h"
#include <stdlib.h>
-// Returns: a * b
+/* Returns: a * b */
-// Effects: aborts if a * b overflows
+/* Effects: aborts if a * b overflows */
si_int
__mulvsi3(si_int a, si_int b)
diff --git a/lib/mulvti3.c b/lib/mulvti3.c
index 82efe8ca..080cd635 100644
--- a/lib/mulvti3.c
+++ b/lib/mulvti3.c
@@ -1,24 +1,25 @@
-//===-- mulvti3.c - Implement __mulvti3 -----------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __mulvti3 for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/* ===-- mulvti3.c - Implement __mulvti3 -----------------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __mulvti3 for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
#if __x86_64
#include "int_lib.h"
#include <stdlib.h>
-// Returns: a * b
+/* Returns: a * b */
-// Effects: aborts if a * b overflows
+/* Effects: aborts if a * b overflows */
ti_int
__mulvti3(ti_int a, ti_int b)
diff --git a/lib/mulxc3.c b/lib/mulxc3.c
index e38ab0dc..94895f25 100644
--- a/lib/mulxc3.c
+++ b/lib/mulxc3.c
@@ -1,15 +1,16 @@
-//===-- mulxc3.c - Implement __mulxc3 -------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __mulxc3 for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/* ===-- mulxc3.c - Implement __mulxc3 -------------------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __mulxc3 for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
#if !_ARCH_PPC
@@ -17,7 +18,7 @@
#include <math.h>
#include <complex.h>
-// Returns: the product of a + ib and c + id
+/* Returns: the product of a + ib and c + id */
long double _Complex
__mulxc3(long double __a, long double __b, long double __c, long double __d)
diff --git a/lib/popcountdi2.c b/lib/popcountdi2.c
index 338bbb3c..78b6d88d 100644
--- a/lib/popcountdi2.c
+++ b/lib/popcountdi2.c
@@ -1,35 +1,36 @@
-//===-- popcountdi2.c - Implement __popcountdi2 ----------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __popcountdi2 for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/* ===-- popcountdi2.c - Implement __popcountdi2 ----------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __popcountdi2 for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
#include "int_lib.h"
-// Returns: count of 1 bits
+/* Returns: count of 1 bits */
si_int
__popcountdi2(di_int a)
{
du_int x2 = (du_int)a;
x2 = x2 - ((x2 >> 1) & 0x5555555555555555uLL);
- // Every 2 bits holds the sum of every pair of bits (32)
+ /* Every 2 bits holds the sum of every pair of bits (32) */
x2 = ((x2 >> 2) & 0x3333333333333333uLL) + (x2 & 0x3333333333333333uLL);
- // Every 4 bits holds the sum of every 4-set of bits (3 significant bits) (16)
+ /* Every 4 bits holds the sum of every 4-set of bits (3 significant bits) (16) */
x2 = (x2 + (x2 >> 4)) & 0x0F0F0F0F0F0F0F0FuLL;
- // Every 8 bits holds the sum of every 8-set of bits (4 significant bits) (8)
+ /* Every 8 bits holds the sum of every 8-set of bits (4 significant bits) (8) */
su_int x = (su_int)(x2 + (x2 >> 32));
- // The lower 32 bits hold four 16 bit sums (5 significant bits).
- // Upper 32 bits are garbage
+ /* The lower 32 bits hold four 16 bit sums (5 significant bits). */
+ /* Upper 32 bits are garbage */
x = x + (x >> 16);
- // The lower 16 bits hold two 32 bit sums (6 significant bits).
- // Upper 16 bits are garbage
- return (x + (x >> 8)) & 0x0000007F; // (7 significant bits)
+ /* The lower 16 bits hold two 32 bit sums (6 significant bits). */
+ /* Upper 16 bits are garbage */
+ return (x + (x >> 8)) & 0x0000007F; /* (7 significant bits) */
}
diff --git a/lib/powitf2.c b/lib/powitf2.c
index 34aa2cb6..3dacbf6b 100644
--- a/lib/powitf2.c
+++ b/lib/powitf2.c
@@ -1,21 +1,22 @@
-//===-- powitf2.cpp - Implement __powitf2 ---------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __powitf2 for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/* ===-- powitf2.cpp - Implement __powitf2 ---------------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __powitf2 for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
#if _ARCH_PPC
#include "int_lib.h"
-// Returns: a ^ b
+/* Returns: a ^ b */
long double
__powitf2(long double a, si_int b)
diff --git a/lib/powixf2.c b/lib/powixf2.c
index 07e145a4..1a816e91 100644
--- a/lib/powixf2.c
+++ b/lib/powixf2.c
@@ -1,21 +1,22 @@
-//===-- powixf2.cpp - Implement __powixf2 ---------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __powixf2 for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/* ===-- powixf2.cpp - Implement __powixf2 ---------------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __powixf2 for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
#if !_ARCH_PPC
#include "int_lib.h"
-// Returns: a ^ b
+/* Returns: a ^ b */
long double
__powixf2(long double a, si_int b)
diff --git a/lib/ucmpti2.c b/lib/ucmpti2.c
index 826360c0..ba32b840 100644
--- a/lib/ucmpti2.c
+++ b/lib/ucmpti2.c
@@ -1,23 +1,25 @@
-//===-- ucmpti2.c - Implement __ucmpti2 -----------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __ucmpti2 for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/* ===-- ucmpti2.c - Implement __ucmpti2 -----------------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __ucmpti2 for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
#if __x86_64
#include "int_lib.h"
-// Returns: if (a < b) returns 0
-// if (a == b) returns 1
-// if (a > b) returns 2
+/* Returns: if (a < b) returns 0
+ * if (a == b) returns 1
+ * if (a > b) returns 2
+ */
si_int
__ucmpti2(tu_int a, tu_int b)
diff --git a/lib/umodti3.c b/lib/umodti3.c
index 57b09efa..6c8a7581 100644
--- a/lib/umodti3.c
+++ b/lib/umodti3.c
@@ -1,15 +1,16 @@
-//===-- umodti3.c - Implement __umodti3 -----------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __umodti3 for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/* ===-- umodti3.c - Implement __umodti3 -----------------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __umodti3 for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
#if __x86_64
@@ -17,7 +18,7 @@
tu_int __udivmodti4(tu_int a, tu_int b, tu_int* rem);
-// Returns: a % b
+/* Returns: a % b */
tu_int
__umodti3(tu_int a, tu_int b)