diff options
author | Petr Hosek <phosek@chromium.org> | 2019-04-28 21:53:32 +0000 |
---|---|---|
committer | Petr Hosek <phosek@chromium.org> | 2019-04-28 21:53:32 +0000 |
commit | db42a0ccf35e49df3a801d4a7964fce06f587542 (patch) | |
tree | 0d27482aeab3a9552c59f06f5ecb9d6fc35e06b7 /lib/builtins/divsi3.c | |
parent | eb2e734bb4c993ee5eff03580fc0bd8e2850e11b (diff) | |
download | compiler-rt-db42a0ccf35e49df3a801d4a7964fce06f587542.tar.gz |
[builtins] Reformat builtins with clang-format
Update formatting to use the LLVM style.
This is part of the cleanup proposed in "[RFC] compiler-rt builtins
cleanup and refactoring".
Differential Revision: https://reviews.llvm.org/D60351
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@359410 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/builtins/divsi3.c')
-rw-r--r-- | lib/builtins/divsi3.c | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/lib/builtins/divsi3.c b/lib/builtins/divsi3.c index dac7aa534..775cdccf9 100644 --- a/lib/builtins/divsi3.c +++ b/lib/builtins/divsi3.c @@ -15,22 +15,20 @@ /* Returns: a / b */ -COMPILER_RT_ABI si_int -__divsi3(si_int a, si_int b) -{ - const int bits_in_word_m1 = (int)(sizeof(si_int) * CHAR_BIT) - 1; - si_int s_a = a >> bits_in_word_m1; /* s_a = a < 0 ? -1 : 0 */ - si_int s_b = b >> bits_in_word_m1; /* s_b = b < 0 ? -1 : 0 */ - a = (a ^ s_a) - s_a; /* negate if s_a == -1 */ - b = (b ^ s_b) - s_b; /* negate if s_b == -1 */ - s_a ^= s_b; /* sign of quotient */ - /* - * On CPUs without unsigned hardware division support, - * this calls __udivsi3 (notice the cast to su_int). - * On CPUs with unsigned hardware division support, - * this uses the unsigned division instruction. - */ - return ((su_int)a/(su_int)b ^ s_a) - s_a; /* negate if s_a == -1 */ +COMPILER_RT_ABI si_int __divsi3(si_int a, si_int b) { + const int bits_in_word_m1 = (int)(sizeof(si_int) * CHAR_BIT) - 1; + si_int s_a = a >> bits_in_word_m1; /* s_a = a < 0 ? -1 : 0 */ + si_int s_b = b >> bits_in_word_m1; /* s_b = b < 0 ? -1 : 0 */ + a = (a ^ s_a) - s_a; /* negate if s_a == -1 */ + b = (b ^ s_b) - s_b; /* negate if s_b == -1 */ + s_a ^= s_b; /* sign of quotient */ + /* + * On CPUs without unsigned hardware division support, + * this calls __udivsi3 (notice the cast to su_int). + * On CPUs with unsigned hardware division support, + * this uses the unsigned division instruction. + */ + return ((su_int)a / (su_int)b ^ s_a) - s_a; /* negate if s_a == -1 */ } #if defined(__ARM_EABI__) |