typedef unsigned int size_t; extern "C" { } enum machine_mode { MAX_MACHINE_MODE, NUM_MACHINE_MODES = MAX_MACHINE_MODE }; enum mode_class { MODE_RANDOM, MODE_CC, MODE_INT, MODE_PARTIAL_INT, MODE_POINTER_BOUNDS, MODE_FRACT, MODE_UFRACT, MODE_ACCUM, MODE_UACCUM, MODE_FLOAT, MODE_DECIMAL_FLOAT, MODE_COMPLEX_INT, MODE_COMPLEX_FLOAT, MODE_VECTOR_INT, MODE_VECTOR_FRACT, MODE_VECTOR_UFRACT, MODE_VECTOR_ACCUM, MODE_VECTOR_UACCUM, MODE_VECTOR_FLOAT, MAX_MODE_CLASS }; extern const unsigned char mode_class[NUM_MACHINE_MODES]; enum signop_e { SIGNED, UNSIGNED }; typedef enum signop_e signop; template class generic_wide_int; class wide_int_storage; typedef generic_wide_int wide_int; template struct wide_int_ref_storage; typedef generic_wide_int > wide_int_ref; namespace wi { enum precision_type { FLEXIBLE_PRECISION, VAR_PRECISION, CONST_PRECISION }; template struct int_traits; template ::precision_type, enum precision_type P2 = int_traits ::precision_type> struct binary_traits; template struct unary_traits : public binary_traits { }; template <> template struct binary_traits { typedef wide_int result_type; }; int clz (const wide_int_ref &); } namespace wi { struct storage_ref { const long long *val; unsigned int len; unsigned int precision; unsigned int get_precision () const; }; } template class generic_wide_int : public storage { public: generic_wide_int (); template generic_wide_int (const T &); long long sign_mask () const; long long elt (unsigned int) const; typename wi::unary_traits ::result_type operator - () const { } template bool operator == (const T &c) const { } }; template inline long long generic_wide_int ::elt (unsigned int i) const { if (i >= this->get_len ()) return sign_mask (); } namespace wi { template <> template struct int_traits < generic_wide_int > : public wi::int_traits { }; } template struct wide_int_ref_storage : public wi::storage_ref { }; namespace wi { template <> template struct int_traits > { static const enum precision_type precision_type = VAR_PRECISION; }; } class wide_int_storage { public: wide_int_storage (); unsigned int get_len () const; static wide_int from (const wide_int_ref &, unsigned int, signop); }; namespace wi { template <> struct int_traits { static const enum precision_type precision_type = VAR_PRECISION; }; } struct real_value { unsigned int uexp : (32 - 6); unsigned long sig[((128 + (8 * 4)) / (8 * 4))]; }; static void decimal_from_integer (struct real_value *); extern void times_pten (struct real_value *, int); static inline void get_zero (struct real_value *r, int sign) {} static void lshift_significand (struct real_value *r, const struct real_value *a, unsigned int n) { unsigned int i; for (i = ((128 + (8 * 4)) / (8 * 4)) - 1; i > 0; --i) r->sig[i] = (a->sig[i] << 1) | (a->sig[i-1] >> ((8 * 4) - 1)); } static inline bool sub_significands (struct real_value *r, const struct real_value *a, const struct real_value *b, int carry) { int i; for (i = 0; i < ((128 + (8 * 4)) / (8 * 4)); ++i) { unsigned long ai = a->sig[i]; unsigned long ri = ai - b->sig[i]; r->sig[i] = ri; } } static inline void neg_significand (struct real_value *r, const struct real_value *a) { int i; for (i = 0; i < ((128 + (8 * 4)) / (8 * 4)); ++i) { } } static inline int cmp_significands (const struct real_value *a, const struct real_value *b) { } static void normalize (struct real_value *r) { } static unsigned long rtd_divmod (struct real_value *num, struct real_value *den) { unsigned long q, msb; int expn = ((int)((num)->uexp ^ (unsigned int)(1 << ((32 - 6) - 1))) - (1 << ((32 - 6) - 1))), expd = ((int)((den)->uexp ^ (unsigned int)(1 << ((32 - 6) - 1))) - (1 << ((32 - 6) - 1))); do { start: if (msb || cmp_significands (num, den) >= 0) { sub_significands (num, num, den, 0); } } while (--expn >= expd); } static void decimal_integer_string (char *str, const struct real_value *r_orig, size_t buf_size) { int dec_exp, digit, digits; struct real_value r, pten; char *p; dec_exp = ((int)((&r)->uexp ^ (unsigned int)(1 << ((32 - 6) - 1))) - (1 << ((32 - 6) - 1))) * 0.30102999566398119521; digits = dec_exp + 1; times_pten (&pten, dec_exp); p = str; digit = rtd_divmod (&r, &pten); while (--digits > 0) { times_pten (&r, 1); digit = rtd_divmod (&r, &pten); *p++ = digit + '0'; } } static void decimal_from_integer (struct real_value *r) { char str[256]; decimal_integer_string (str, r, sizeof (str) - 1); } void real_from_integer (struct real_value *r, machine_mode mode, const wide_int_ref &val_in, signop sgn) { if (val_in == 0) get_zero (r, 0); else { unsigned int len = val_in.get_precision (); int i, j, e = 0; int maxbitlen = (16*(8)) + 64; const unsigned int realmax = ((128 + (8 * 4)) / 64 * 64); wide_int val = wide_int::from (val_in, maxbitlen, sgn); if (len > realmax) { long long cnt_l_z; cnt_l_z = wi::clz (val); if (maxbitlen - cnt_l_z > realmax) { } len = realmax; } val = wide_int::from (val, len, sgn); j = ((128 + (8 * 4)) / (8 * 4)) - 1; if ((8 * 4) == 64) for (i = len - 1; i >= 0; i--) { } else { for (i = len - 1; i >= 0; i--) { long long e = val.elt (i); r->sig[j--] = e >> ((8 * 4) - 1) >> 1; r->sig[j--] = e; } } } if ((((enum mode_class) mode_class[mode]) == MODE_DECIMAL_FLOAT)) decimal_from_integer (r); }