diff options
author | Edward O'Callaghan <eocallaghan@auroraux.org> | 2009-08-05 04:02:56 +0000 |
---|---|---|
committer | Edward O'Callaghan <eocallaghan@auroraux.org> | 2009-08-05 04:02:56 +0000 |
commit | 2bf62728b8ce00e295c7bf0fb328427496cc85aa (patch) | |
tree | 4387ffcd063b8111e471f320fe1c1c437063c272 /lib/clzsi2.c | |
parent | 0e4ad9c55a8554a220af3dc6b0fc4b0a5d64c025 (diff) | |
download | compiler-rt-2bf62728b8ce00e295c7bf0fb328427496cc85aa.tar.gz |
Fixup C++ style comments are not allowed in ISO C90 to classic C style.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@78152 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/clzsi2.c')
-rw-r--r-- | lib/clzsi2.c | 76 |
1 files changed, 39 insertions, 37 deletions
diff --git a/lib/clzsi2.c b/lib/clzsi2.c index 52062ab22..7e14af293 100644 --- a/lib/clzsi2.c +++ b/lib/clzsi2.c @@ -1,51 +1,53 @@ -//===-- clzsi2.c - Implement __clzsi2 -------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file implements __clzsi2 for the compiler_rt library. -// -//===----------------------------------------------------------------------===// +/* ===-- clzsi2.c - Implement __clzsi2 -------------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is distributed under the University of Illinois Open Source + * License. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __clzsi2 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ #include "int_lib.h" -// Returns: the number of leading 0-bits +/* Returns: the number of leading 0-bits */ -// Precondition: a != 0 +/* Precondition: a != 0 */ si_int __clzsi2(si_int a) { su_int x = (su_int)a; - si_int t = ((x & 0xFFFF0000) == 0) << 4; // if (x is small) t = 16 else 0 - x >>= 16 - t; // x = [0 - 0xFFFF] - su_int r = t; // r = [0, 16] - // return r + clz(x) + si_int t = ((x & 0xFFFF0000) == 0) << 4; /* if (x is small) t = 16 else 0 */ + x >>= 16 - t; /* x = [0 - 0xFFFF] */ + su_int r = t; /* r = [0, 16] */ + /* return r + clz(x) */ t = ((x & 0xFF00) == 0) << 3; - x >>= 8 - t; // x = [0 - 0xFF] - r += t; // r = [0, 8, 16, 24] - // return r + clz(x) + x >>= 8 - t; /* x = [0 - 0xFF] */ + r += t; /* r = [0, 8, 16, 24] */ + /* return r + clz(x) */ t = ((x & 0xF0) == 0) << 2; - x >>= 4 - t; // x = [0 - 0xF] - r += t; // r = [0, 4, 8, 12, 16, 20, 24, 28] - // return r + clz(x) + x >>= 4 - t; /* x = [0 - 0xF] */ + r += t; /* r = [0, 4, 8, 12, 16, 20, 24, 28] */ + /* return r + clz(x) */ t = ((x & 0xC) == 0) << 1; - x >>= 2 - t; // x = [0 - 3] - r += t; // r = [0 - 30] and is even - // return r + clz(x) -// switch (x) -// { -// case 0: -// return r + 2; -// case 1: -// return r + 1; -// case 2: -// case 3: -// return r; -// } + x >>= 2 - t; /* x = [0 - 3] */ + r += t; /* r = [0 - 30] and is even */ + /* return r + clz(x) */ +/* switch (x) + * { + * case 0: + * return r + 2; + * case 1: + * return r + 1; + * case 2: + * case 3: + * return r; + * } + */ return r + ((2 - x) & -((x & 2) == 0)); } |