1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233
|
/* file generated by oo2c -- do not edit */
#include "__oo2c.h"
#include "__libc.h"
#include "LongInts.d"
static _ModId _mid;
int LongInts__MinDigit(LongInts__LongInt w) {
register int i0, i1;
i0 = (int)w + 2;
i0 = *(short int*)i0;
i0 = i0 == 0;
if (i0) goto l0;
i1 = 1;
goto l2;
l0:
i1 = 1;
l1:
i1++;
i0 = i1 >= 169;
if (i0) goto l2;
i0 = (int)_ashl(i1, 1, (unsigned int));
i0 = (int)w + i0;
i0 = *(short int*)i0;
i0 = i0 == 0;
if (i0) goto l1;
l2:
return (int)i1;
}
void LongInts__MultDigit(LongInts__LongInt w, int digit, int k) {
register int i0, i1, i2, i3, i4, i5;
i0 = LongInts__MinDigit((short int*)(int)w);
i4 = i0 - 2;
i3 = 169;
i0 = k;
l0:
i2 = (int)_ashl(i3, 1, (unsigned int));
i2 = (int)w + i2;
i1 = *(short int*)i2;
i1 = digit * i1;
i0 += i1;
i5 = i0 & 0x7FFFU;
i1 = i3 - 1;
*(short int*)i2 = i5;
i3 = i1 == i4;
i0 = (int)_ashr(i0, 15, (unsigned int));
if (i3) goto l1;
i3 = i1;
goto l0;
l1:
;
}
void LongInts__AddDigit(LongInts__LongInt w, int k) {
register int i0, i1, i2, i3, i4, i5;
i0 = LongInts__MinDigit((short int*)(int)w);
i4 = i0 - 2;
i3 = 169;
i0 = k;
l0:
i2 = (int)_ashl(i3, 1, (unsigned int));
i2 = (int)w + i2;
i1 = *(short int*)i2;
i0 += i1;
i5 = i0 & 0x7FFFU;
i1 = i3 - 1;
*(short int*)i2 = i5;
i3 = i1 == i4;
i0 = (int)_ashr(i0, 15, (unsigned int));
if (i3) goto l1;
i3 = i1;
goto l0;
l1:
;
}
void LongInts__DivDigit(LongInts__LongInt w, int digit, int *r) {
register int i0, i1, i2, i3;
i0 = LongInts__MinDigit((short int*)(int)w);
i3 = i0 - 1;
*r = 0;
l0:
i2 = (int)_ashl(i3, 1, (unsigned int));
i2 = (int)w + i2;
i1 = *(short int*)i2;
i0 = *r;
i0 = (int)_ashl(i0, 15, (unsigned int));
i1 += i0;
_div(i0, i1, digit, int);
*(short int*)i2 = i0;
i3++;
_mod(i2, i1, digit, int);
*r = i2;
i2 = i3 <= 169;
if (i2) goto l0;
}
void LongInts__TenPower(LongInts__LongInt x, short int power) {
register int i0, i1, i2, i3, i4;
int d;
i0 = power > 0;
if (i0) goto l5;
i3 = power >= 0;
if (i3) goto l9;
i2 = - power;
i3 = (short int)_ashr(i2, 2, (unsigned short int));
i0 = i3 >= 1;
if (i0) goto l0;
goto l3;
l0:
i0 = 1;
l1:
i0++;
i1 = i0 > i3;
d = (int)i4;
LongInts__DivDigit((short int*)(int)x, (int)10000, (int *)(int)&d);
if (i1) goto l2;
i4 = d;
goto l1;
l2:
i0 = d;
l3:
i2 &= 0x3U;
i1 = i2 < 1;
if (i1) goto l9;
i3 = 1;
l4:
i3++;
i1 = i2 < i3;
d = (int)i0;
LongInts__DivDigit((short int*)(int)x, (int)10, (int *)(int)&d);
if (i1) goto l9;
i0 = d;
goto l4;
l5:
i2 = (short int)_ashr(power, 2, (unsigned short int));
i1 = i2 < 1;
if (i1) goto l7;
i1 = 1;
l6:
i1++;
i0 = i1 <= i2;
LongInts__MultDigit((short int*)(int)x, (int)10000, (int)0);
if (i0) goto l6;
l7:
i0 = power & 0x3U;
i1 = i0 < 1;
if (i1) goto l9;
i1 = 1;
l8:
i1++;
i2 = i0 >= i1;
LongInts__MultDigit((short int*)(int)x, (int)10, (int)0);
if (i2) goto l8;
l9:
;
}
void LongInts__BPower(LongInts__LongInt x, short int power) {
register int i0, i1, i2, i3, i4, i5;
i0 = power > 0;
if (i0) goto l3;
i4 = power >= 0;
if (i4) goto l7;
i4 = - power;
i5 = 169 - i4;
i0 = i5 < 1;
if (i0) goto l1;
l0:
i0 = i5 + i4;
i1 = (int)_ashl(i5, 1, (unsigned int));
i3 = (int)_ashl(i0, 1, (unsigned int));
i1 = (int)x + i1;
i2 = i5 + -1;
i3 = (int)x + i3;
i5 = *(short int*)i1;
*(short int*)i3 = i5;
i5 = i2 < 1;
if (i5) goto l1;
i5 = i2;
goto l0;
l1:
i0 = i4 >= 1;
if (!(i0)) goto l7;
i3 = 1;
l2:
i1 = (int)_ashl(i3, 1, (unsigned int));
i0 = i3 + 1;
i1 = (int)x + i1;
i2 = i4 < i0;
*(short int*)i1 = 0;
if (i2) goto l7;
i3 = i0;
goto l2;
l3:
i0 = 169 - power;
i4 = i0 < 1;
if (i4) goto l5;
i4 = 1;
l4:
i3 = i4 + power;
i2 = (int)_ashl(i3, 1, (unsigned int));
i2 = (int)x + i2;
i3 = *(short int*)i2;
i5 = (int)_ashl(i4, 1, (unsigned int));
i2 = i4 + 1;
i5 = (int)x + i5;
i1 = i2 > i0;
*(short int*)i5 = i3;
if (i1) goto l5;
i4 = i2;
goto l4;
l5:
i2 = 170 - power;
i4 = i2 > 169;
if (i4) goto l7;
l6:
i3 = (int)_ashl(i2, 1, (unsigned int));
i4 = i2 + 1;
i3 = (int)x + i3;
i1 = i4 > 169;
*(short int*)i3 = 0;
if (i1) goto l7;
i2 = i4;
goto l6;
l7:
;
}
void LongInts_init(void) {
_mid = _register_module(&LongInts_md.md, NULL);
}
|