Lines Matching refs:fmt
65 static int floatformat_always_valid (const struct floatformat *fmt,
69 floatformat_always_valid (const struct floatformat *fmt ATTRIBUTE_UNUSED,
169 static int floatformat_i387_ext_is_valid (const struct floatformat *fmt,
173 floatformat_i387_ext_is_valid (const struct floatformat *fmt, const void *from)
182 exponent = get_field (ufrom, fmt->byteorder, fmt->totalsize,
183 fmt->exp_start, fmt->exp_len);
184 int_bit = get_field (ufrom, fmt->byteorder, fmt->totalsize,
185 fmt->man_start, 1);
289 floatformat_ibm_long_double_is_valid (const struct floatformat *fmt,
293 const struct floatformat *hfmt = fmt->split_half;
399 format FMT, 0 otherwise. */
401 mant_bits_set (const struct floatformat *fmt, const unsigned char *ufrom)
406 mant_off = fmt->man_start;
407 mant_bits_left = fmt->man_len;
412 if (get_field (ufrom, fmt->byteorder, fmt->totalsize,
462 /* Convert from FMT to a double.
467 floatformat_to_double (const struct floatformat *fmt,
481 exponent = get_field (ufrom, fmt->byteorder, fmt->totalsize,
482 fmt->exp_start, fmt->exp_len);
487 if ((unsigned long) exponent == fmt->exp_nan)
489 int nan = mant_bits_set (fmt, ufrom);
503 if (get_field (ufrom, fmt->byteorder, fmt->totalsize, fmt->sign_start, 1))
511 mant_bits_left = fmt->man_len;
512 mant_off = fmt->man_start;
520 exponent = 1 - fmt->exp_bias;
523 exponent -= fmt->exp_bias;
529 if (fmt->intbit == floatformat_intbit_no)
539 mant = get_field (ufrom, fmt->byteorder, fmt->totalsize,
549 if (get_field (ufrom, fmt->byteorder, fmt->totalsize, fmt->sign_start, 1))
604 floatformat_from_double (const struct floatformat *fmt,
615 memset (uto, 0, fmt->totalsize / FLOATFORMAT_CHAR_BIT);
624 put_field (uto, fmt->byteorder, fmt->totalsize, fmt->sign_start, 1, 1);
637 put_field (uto, fmt->byteorder, fmt->totalsize, fmt->exp_start,
638 fmt->exp_len, fmt->exp_nan);
640 put_field (uto, fmt->byteorder, fmt->totalsize, fmt->man_start,
649 put_field (uto, fmt->byteorder, fmt->totalsize, fmt->exp_start,
650 fmt->exp_len, fmt->exp_nan);
655 if (exponent + fmt->exp_bias - 1 > 0)
656 put_field (uto, fmt->byteorder, fmt->totalsize, fmt->exp_start,
657 fmt->exp_len, exponent + fmt->exp_bias - 1);
662 put_field (uto, fmt->byteorder, fmt->totalsize, fmt->exp_start,
663 fmt->exp_len, 0);
664 mant = ldexp (mant, exponent + fmt->exp_bias - 1);
667 mant_bits_left = fmt->man_len;
668 mant_off = fmt->man_start;
680 if ((unsigned int) mant_bits_left == fmt->man_len
681 && fmt->intbit == floatformat_intbit_no
682 && exponent + fmt->exp_bias - 1 > 0)
694 put_field (uto, fmt->byteorder, fmt->totalsize,
701 /* Return non-zero iff the data at FROM is a valid number in format FMT. */
704 floatformat_is_valid (const struct floatformat *fmt, const void *from)
706 return fmt->is_valid (fmt, from);