indent patch.c patch.h

This commit is contained in:
Bill Kendrick 2017-10-15 11:21:19 -07:00
parent 7c0c9d2471
commit b8d199fef7
2 changed files with 253 additions and 253 deletions

View file

@ -64,6 +64,7 @@ patch_i18n(const char* locale)
typedef unsigned su_int;
typedef long long di_int;
typedef unsigned long long du_int;
#ifdef __i386__
typedef int ti_int __attribute__ ((mode(DI)));
typedef unsigned tu_int __attribute__ ((mode(DI)));
@ -93,12 +94,15 @@ tu_int __udivmodti4(tu_int a, tu_int b, tu_int* rem)
const unsigned n_udword_bits = sizeof(du_int) * CHAR_BIT;
const unsigned n_utword_bits = sizeof(tu_int) * CHAR_BIT;
utwords n;
n.all = a;
utwords d;
d.all = b;
utwords q;
utwords r;
unsigned sr;
/* special cases, X is unknown, K != 0 */
if (n.s.high == 0)
{
@ -198,6 +202,7 @@ tu_int __udivmodti4(tu_int a, tu_int b, tu_int* rem)
if (d.s.low == 1)
return n.all;
unsigned sr = __builtin_ctzll(d.s.low);
q.s.high = n.s.high >> sr;
q.s.low = (n.s.high << (n_udword_bits - sr)) | (n.s.low >> sr);
return q.all;
@ -206,8 +211,7 @@ tu_int __udivmodti4(tu_int a, tu_int b, tu_int* rem)
* ---
* 0 K
*/
sr = 1 + n_udword_bits + __builtin_clzll(d.s.low)
- __builtin_clzll(n.s.high);
sr = 1 + n_udword_bits + __builtin_clzll(d.s.low) - __builtin_clzll(n.s.high);
/* 2 <= sr <= n_utword_bits - 1
* q.all = n.all << (n_utword_bits - sr);
* r.all = n.all >> sr;
@ -234,20 +238,16 @@ tu_int __udivmodti4(tu_int a, tu_int b, tu_int* rem)
* r.s.low = n.s.high >> (sr - n_udword_bits);
* }
*/
q.s.low = (n.s.low << (n_utword_bits - sr)) &
((di_int)(int)(n_udword_bits - sr) >> (n_udword_bits-1));
q.s.low = (n.s.low << (n_utword_bits - sr)) & ((di_int) (int)(n_udword_bits - sr) >> (n_udword_bits - 1));
q.s.high = ((n.s.low << (n_udword_bits - sr)) &
((di_int) (int)(sr - n_udword_bits - 1) >> (n_udword_bits - 1))) |
(((n.s.high << (n_utword_bits - sr)) |
(n.s.low >> (sr - n_udword_bits))) &
((di_int)(int)(n_udword_bits - sr) >> (n_udword_bits-1)));
r.s.high = (n.s.high >> sr) &
((di_int)(int)(sr - n_udword_bits) >> (n_udword_bits-1));
(n.s.low >> (sr - n_udword_bits))) & ((di_int) (int)(n_udword_bits - sr) >> (n_udword_bits - 1)));
r.s.high = (n.s.high >> sr) & ((di_int) (int)(sr - n_udword_bits) >> (n_udword_bits - 1));
r.s.low = ((n.s.high >> (sr - n_udword_bits)) &
((di_int) (int)(n_udword_bits - sr - 1) >> (n_udword_bits - 1))) |
(((n.s.high << (n_udword_bits - sr)) |
(n.s.low >> sr)) &
((di_int)(int)(sr - n_udword_bits) >> (n_udword_bits-1)));
(n.s.low >> sr)) & ((di_int) (int)(sr - n_udword_bits) >> (n_udword_bits - 1)));
}
else
{
@ -280,11 +280,9 @@ tu_int __udivmodti4(tu_int a, tu_int b, tu_int* rem)
* r.s.low = n.s.high;
* }
*/
r.s.high = (n.s.high >> sr) &
((di_int)(int)(sr - n_udword_bits) >> (n_udword_bits-1));
r.s.high = (n.s.high >> sr) & ((di_int) (int)(sr - n_udword_bits) >> (n_udword_bits - 1));
r.s.low = (n.s.high << (n_udword_bits - sr)) |
((n.s.low >> sr) &
((di_int)(int)(sr - n_udword_bits) >> (n_udword_bits-1)));
((n.s.low >> sr) & ((di_int) (int)(sr - n_udword_bits) >> (n_udword_bits - 1)));
}
}
/* Not a special case
@ -294,6 +292,7 @@ tu_int __udivmodti4(tu_int a, tu_int b, tu_int* rem)
* 1 <= sr <= n_utword_bits - 1
*/
su_int carry = 0;
for (; sr > 0; --sr)
{
/* r:q = ((r:q) << 1) | carry */
@ -309,6 +308,7 @@ tu_int __udivmodti4(tu_int a, tu_int b, tu_int* rem)
* }
*/
const ti_int s = (ti_int) (d.all - r.all - 1) >> (n_utword_bits - 1);
carry = s & 1;
r.all -= d.all & s;
}
@ -323,6 +323,7 @@ tu_int __udivmodti4(tu_int a, tu_int b, tu_int* rem)
tu_int __umodti3(tu_int a, tu_int b)
{
tu_int r;
__udivmodti4(a, b, &r);
return r;
}
@ -362,4 +363,3 @@ int posix_memalign(void **ptr, size_t align, size_t size)
typedef jmp_buf *(*png_set_longjmp_fnPtr) (png_structp, void *, size_t);
png_set_longjmp_fnPtr png_set_longjmp_fn = 0;
#endif