deep-c-rsc/jcgo_Out/Mpn.c
Mister Hat 9769d9fe69 init
2021-07-16 17:09:34 -05:00

415 lines
8.0 KiB
C

/* DO NOT EDIT THIS FILE - it is machine generated (JCGO_116) */
#ifdef JCGO_SEPARATED
#define JCGO_116
#include "jcgortl.h"
#include "Main.h"
#endif
#ifdef JCGO_116
#ifdef CHKALL_gnu_java_math_MPN
#include "jcgobchk.h"
#endif
JCGO_NOSEP_INLINE jint CFASTCALL
gnu_java_math_MPN__mul_1__IAIAII( jintArr dest, jintArr x, jint len,
jint y )
{
{
jlong yword;
jlong carry;
yword= (jlong)y & JLONG_C(0xffffffff);
carry= (jlong)0;
{
jint j;
j= 0;
for (; j < len; j++)
{
carry+= ((jlong)JCGO_ARRAY_IACCESS(x, j) & JLONG_C(0xffffffff)) *
yword;
JCGO_ARRAY_IACCESS(dest, j)= ((jint)carry);
carry= JCGO_LUSHR_F(carry, (jint)32);
}
}
return (jint)carry;
}
}
JCGO_NOSEP_INLINE jint CFASTCALL
gnu_java_math_MPN__add_1__IAIAII( jintArr dest, jintArr x, jint size,
jint y )
{
{
jlong carry;
carry= (jlong)y & JLONG_C(0xffffffff);
{
jint i;
i= 0;
for (; i < size; i++)
{
carry+= ((jlong)JCGO_ARRAY_IACCESS(x, i) & JLONG_C(0xffffffff));
JCGO_ARRAY_IACCESS(dest, i)= ((jint)carry);
carry= JCGO_LSHR_F(carry, (jint)32);
}
}
return (jint)carry;
}
}
JCGO_NOSEP_INLINE jlong CFASTCALL
gnu_java_math_MPN__udiv_qrnnd__JI( jlong N, jint D )
{
{
jlong q;
jlong r;
jlong a1;
jlong a0;
a1= JCGO_LUSHR_F(N, (jint)32);
a0= N & JLONG_C(0xffffffff);
if (D >= 0)
{
if (a1 < (((jlong)D - a1 - JCGO_LUSHR_F(a0, (jint)31)) & JLONG_C(0xffffffff)))
{
q= jcgo_ldiv(N, (jlong)D);
r= jcgo_lmod(N, (jlong)D);
}
else
{
jlong c;
c= N - JCGO_LSHL_F((jlong)D, (jint)31);
q= jcgo_ldiv(c, (jlong)D);
r= jcgo_lmod(c, (jlong)D);
q+= (jlong)JCGO_SHL_F((jint)1, (jint)31);
}
}
else
{
jlong b1;
jlong c;
b1= (jlong)JCGO_USHR_F(D, (jint)1);
c= JCGO_LUSHR_F(N, (jint)1);
if (a1 < b1 || JCGO_LSHR_F(a1, (jint)1) < b1)
{
if (a1 < b1)
{
q= jcgo_ldiv(c, b1);
r= jcgo_lmod(c, b1);
}
else
{
c= ~(c - JCGO_LSHL_F(b1, (jint)32));
q= jcgo_ldiv(c, b1);
r= jcgo_lmod(c, b1);
q= (~q) & JLONG_C(0xffffffff);
r= (b1 - (jlong)(jint)1) - r;
}
r= r * (jlong)(jint)2 + (a0 & (jlong)(jint)1);
if ((D & (jint)1) != 0)
{
if (r >= q)
{
r= r - q;
}
else
{
if (q - r <= ((jlong)D & JLONG_C(0xffffffff)))
{
r= r - q + (jlong)D;
q-= (jlong)(jint)1;
}
else
{
r= r - q + (jlong)D + (jlong)D;
q-= (jlong)(jint)2;
}
}
}
}
else
{
if (a0 >= ((jlong)(-D) & JLONG_C(0xffffffff)))
{
q= (jlong)(-(jint)1);
r= a0 + (jlong)D;
}
else
{
q= (jlong)(-(jint)2);
r= a0 + (jlong)D + (jlong)D;
}
}
}
return JCGO_LSHL_F(r, (jint)32) | (q & JLONG_C(0xffffffff));
}
}
JCGO_NOSEP_FRWINL jint CFASTCALL
gnu_java_math_MPN__divmod_1__IAIAII( jintArr quotient, jintArr dividend,
jint len, jint divisor )
{
{
jlong r;
jint i;
i= len - (jint)1;
r= (jlong)(JCGO_ARRAY_IACCESS(dividend, i));
if ((r & JLONG_C(0xffffffff)) >= ((jlong)divisor & JLONG_C(0xffffffff)))
{
r= (jlong)0;
}
else
{
JCGO_ARRAY_IACCESS(quotient, i--)= 0;
r= JCGO_LSHL_F(r, (jint)32);
}
for (; i >= 0; i--)
{
jint n0;
n0= JCGO_ARRAY_NZIACCESS(dividend, i);
r= (r & JLONG_C(0xffffffff00000000)) | ((jlong)n0 & JLONG_C(0xffffffff));
r= (gnu_java_math_MPN__udiv_qrnnd__JI(
r, divisor));
JCGO_ARRAY_IACCESS(quotient, i)= ((jint)r);
}
return (jint)JCGO_LSHR_F(r, (jint)32);
}
}
JCGO_NOSEP_STATIC jint CFASTCALL
gnu_java_math_MPN__chars_per_word__I( jint radix )
{
{
if (radix < (jint)10)
{
if (radix < (jint)8)
{
if (radix <= (jint)2)
{
return (jint)32;
}
else
{
if (radix == (jint)3)
{
return (jint)20;
}
else
{
if (radix == (jint)4)
{
return (jint)16;
}
else
{
return (jint)18 - radix;
}
}
}
}
else
{
return (jint)10;
}
}
else
{
if (radix < (jint)12)
{
return (jint)9;
}
else
{
if (radix <= (jint)16)
{
return (jint)8;
}
else
{
if (radix <= (jint)23)
{
return (jint)7;
}
else
{
if (radix <= (jint)40)
{
return (jint)6;
}
else
{
if (radix <= (jint)256)
{
return (jint)4;
}
else
{
return (jint)1;
}
}
}
}
}
}
}
}
JCGO_NOSEP_FRWINL jint CFASTCALL
gnu_java_math_MPN__set_str__IABAII( jintArr dest, jbyteArr str, jint
str_len, jint base )
{
{
jint size;
size= 0;
if ((base & (base - (jint)1)) == 0)
{
jint next_bitpos;
jint bits_per_indigit;
jint res_digit;
next_bitpos= 0;
bits_per_indigit= 0;
{
jint i;
i= base;
for (; (i= JCGO_SHR_F(i, (jint)1)) != 0;)
{
bits_per_indigit++;
}
}
res_digit= 0;
{
jint i;
i= str_len;
for (; --i >= 0;)
{
jint inp_digit;
inp_digit= (jint)(JCGO_ARRAY_BACCESS(str, i));
res_digit|= JCGO_SHL_F(inp_digit, next_bitpos);
next_bitpos+= bits_per_indigit;
if (next_bitpos >= (jint)32)
{
JCGO_ARRAY_IACCESS(dest, size++)= res_digit;
next_bitpos-= (jint)32;
res_digit= JCGO_SHR_F(inp_digit, (bits_per_indigit - next_bitpos));
}
}
}
if (res_digit != 0)
{
JCGO_ARRAY_IACCESS(dest, size++)= res_digit;
}
}
else
{
jint indigits_per_limb;
jint str_pos;
indigits_per_limb= (gnu_java_math_MPN__chars_per_word__I(
base));
str_pos= 0;
while (str_pos < str_len)
{
jint chunk;
jint res_digit;
jint big_base;
jint cy_limb;
chunk= str_len - str_pos;
if (chunk > indigits_per_limb)
{
chunk= indigits_per_limb;
}
res_digit= (jint)(JCGO_ARRAY_BACCESS(str, str_pos++));
big_base= base;
while (--chunk > 0)
{
res_digit= res_digit * base + JCGO_ARRAY_NZBACCESS(str, str_pos++);
big_base*= base;
}
;
if (size == 0)
{
cy_limb= res_digit;
}
else
{
cy_limb= (gnu_java_math_MPN__mul_1__IAIAII(
dest, dest, size, big_base));
cy_limb+= (gnu_java_math_MPN__add_1__IAIAII(
dest, dest, size, res_digit));
}
if (cy_limb != 0)
{
JCGO_ARRAY_IACCESS(dest, size++)= cy_limb;
}
}
}
return size;
}
}
JCGO_NOSEP_STATIC gnu_java_math_MPN CFASTCALL
gnu_java_math_MPN__this__( gnu_java_math_MPN This )
{
{
;
}
return This;
}
JCGO_NOSEP_DATA CONST struct gnu_java_math_MPN_methods_s gnu_java_math_MPN_methods=
{
JCGO_CLASSREF_OF(gnu_java_math_MPN__class),
JCGO_GCJDESCR_ZEROINIT
OBJT_gnu_java_math_MPN,
-(JCGO_OBJSIZE_T)sizeof(struct gnu_java_math_MPN_s),
NULL,
JCGO_CLINIT_INIT(0)
gnu_java_math_MPN__this__,
java_lang_Object__equals__Lo,
java_lang_Object__hashCode__,
java_lang_Object__toString__,
java_lang_Object__finalize__
};
JCGO_NOSEP_DATA JCGO_NOTHR_CONST struct gnu_java_math_MPN_class_s
gnu_java_math_MPN__class JCGO_THRD_ATTRNONGC=
{
{
&java_lang_Class_methods,
JCGO_MON_INIT
JCGO_OBJREF_OF(*(java_lang_Object)&gnu_java_math_MPN_methods),
JCGO_STRREF_OF(jcgo_string1_Mpn),
JCGO_CLASSREF_OF(java_lang_Object__class),
((jObjectArr)JCGO_OBJREF_OF(jcgo_array3_Object)),
0x1
}
};
JCGO_NOSEP_DATA CONST jcgo_arrtype492_Mdclnt jcgo_array2_Mpn=
{
(jvtable)&jbyteArr_methods,
JCGO_MON_INIT
17,
{
(jbyte)(jchar)103/*'g'*/, (jbyte)(jchar)110/*'n'*/, (jbyte)(jchar)117/*'u'*/,
(jbyte)(jchar)46/*'.'*/, (jbyte)(jchar)106/*'j'*/, (jbyte)(jchar)97/*'a'*/,
(jbyte)(jchar)118/*'v'*/, (jbyte)(jchar)97/*'a'*/, (jbyte)(jchar)46/*'.'*/,
(jbyte)(jchar)109/*'m'*/, (jbyte)(jchar)97/*'a'*/, (jbyte)(jchar)116/*'t'*/,
(jbyte)(jchar)104/*'h'*/, (jbyte)(jchar)46/*'.'*/, (jbyte)(jchar)77/*'M'*/,
(jbyte)(jchar)80/*'P'*/, (jbyte)(jchar)78/*'N'*/
}
};
JCGO_NOSEP_DATA JCGO_NOTHR_CONST struct java_lang_String_s jcgo_string1_Mpn
JCGO_THRD_ATTRNONGC=
{
&java_lang_String_methods,
JCGO_MON_INIT
(java_lang_Object)JCGO_OBJREF_OF(jcgo_array2_Mpn),
0, 17, (jint)0x9c2057f1L
};
#ifdef CHKALL_gnu_java_math_MPN
#include "jcgochke.h"
#endif
#endif