_fpmaxtostr.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /* vi: set sw=4 ts=4: */
  2. /*
  3. * Copyright (C) 2000,2001,2003,2004 Manuel Novoa III <mjn3@codepoet.org>
  4. *
  5. * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  6. *
  7. * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details.
  8. */
  9. #ifndef _FPMAXTOSTR_H
  10. #define _FPMAXTOSTR_H 1
  11. #include <features.h>
  12. #define __need_size_t
  13. #include <stddef.h>
  14. #include <stdint.h>
  15. #include <stdio.h>
  16. #include <printf.h>
  17. #include <sys/types.h>
  18. #ifdef __UCLIBC_HAS_FLOATS__
  19. # include <float.h>
  20. # include <bits/uClibc_fpmax.h>
  21. /* WARNING: Adjust _fp_out_wide() in _vfprintf.c if this changes! */
  22. /* With 32 bit ints, we can get 9 decimal digits per block. */
  23. # define DIGITS_PER_BLOCK 9
  24. # define NUM_DIGIT_BLOCKS ((DECIMAL_DIG+DIGITS_PER_BLOCK-1)/DIGITS_PER_BLOCK)
  25. /* WARNING: Adjust _fp_out_wide() in _vfprintf.c if this changes! */
  26. /* extra space for '-', '.', 'e+###', and nul */
  27. # define BUF_SIZE ( 3 + NUM_DIGIT_BLOCKS * DIGITS_PER_BLOCK )
  28. /* psm: why do these internals differ? */
  29. # ifdef __USE_OLD_VFPRINTF__
  30. typedef void (__fp_outfunc_t)(FILE *fp, intptr_t type, intptr_t len, intptr_t buf);
  31. extern size_t _fpmaxtostr(FILE * fp, __fpmax_t x, struct printf_info *info,
  32. __fp_outfunc_t fp_outfunc) attribute_hidden;
  33. # else
  34. typedef size_t (__fp_outfunc_t)(FILE *fp, intptr_t type, intptr_t len, intptr_t buf);
  35. extern ssize_t _fpmaxtostr(FILE * fp, __fpmax_t x, struct printf_info *info,
  36. __fp_outfunc_t fp_outfunc) attribute_hidden;
  37. # endif
  38. # endif /* __UCLIBC_HAS_FLOATS__ */
  39. #endif /* _FPMAXTOSTR_H */