]> git.proxmox.com Git - mirror_edk2.git/blobdiff - StdLib/LibC/gdtoa/ldtoa.c
edk2: Remove AppPkg, StdLib, StdLibPrivateInternalFiles
[mirror_edk2.git] / StdLib / LibC / gdtoa / ldtoa.c
diff --git a/StdLib/LibC/gdtoa/ldtoa.c b/StdLib/LibC/gdtoa/ldtoa.c
deleted file mode 100644 (file)
index 8e38b62..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-/*  $NetBSD: ldtoa.c,v 1.4.2.1 2007/05/07 19:49:06 pavel Exp $  */\r
-\r
-/*-\r
- * Copyright (c) 2003 David Schultz <das@FreeBSD.ORG>\r
- * All rights reserved.\r
- *\r
- * Redistribution and use in source and binary forms, with or without\r
- * modification, are permitted provided that the following conditions\r
- * are met:\r
- * 1. Redistributions of source code must retain the above copyright\r
- *    notice, this list of conditions and the following disclaimer.\r
- * 2. Redistributions in binary form must reproduce the above copyright\r
- *    notice, this list of conditions and the following disclaimer in the\r
- *    documentation and/or other materials provided with the distribution.\r
- *\r
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\r
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\r
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
- * SUCH DAMAGE.\r
- */\r
-#include  <LibConfig.h>\r
-#include <sys/EfiCdefs.h>\r
-\r
-#include <float.h>\r
-#include <inttypes.h>\r
-#include <limits.h>\r
-#include <math.h>\r
-#include <stdlib.h>\r
-#include <machine/ieee.h>\r
-#include "gdtoaimp.h"\r
-\r
-#if defined(_MSC_VER)\r
-  /*  Disable warnings about conversions to narrower data types,\r
-      primarily for the fpclassify() macro.\r
-  */\r
-  #pragma warning ( disable : 4244 )\r
-  // Squelch bogus warnings about uninitialized variable use.\r
-  #pragma warning ( disable : 4700 )\r
-#endif\r
-\r
-/*\r
- * ldtoa() is a wrapper for gdtoa() that makes it smell like dtoa(),\r
- * except that the floating point argument is passed by reference.\r
- * When dtoa() is passed a NaN or infinity, it sets expt to 9999.\r
- * However, a long double could have a valid exponent of 9999, so we\r
- * use INT_MAX in ldtoa() instead.\r
- */\r
-char *\r
-ldtoa(long double *ld, int mode, int ndigits, int *decpt, int *sign, char **rve)\r
-{\r
-#ifdef EXT_EXPBITS\r
-  static FPI fpi = {\r
-    LDBL_MANT_DIG,      /* nbits */\r
-    LDBL_MIN_EXP - LDBL_MANT_DIG, /* emin */\r
-    LDBL_MAX_EXP - LDBL_MANT_DIG, /* emax */\r
-    FPI_Round_near,           /* rounding */\r
-#ifdef Sudden_Underflow /* unused, but correct anyway */\r
-    1\r
-#else\r
-    0\r
-#endif\r
-  };\r
-  int be, kind;\r
-  char *ret;\r
-  union ieee_ext_u u;\r
-  uint32_t bits[(LDBL_MANT_DIG + 31) / 32];\r
-\r
-  u.extu_ld = *ld;\r
-  *sign = (int)(u.extu_ext.ext_sign);\r
-  be = (int)(u.extu_ext.ext_exp - (LDBL_MAX_EXP - 1) - (LDBL_MANT_DIG - 1));\r
-  EXT_TO_ARRAY32(u, bits);\r
-\r
-  switch (fpclassify(u.extu_ld)) {\r
-  case FP_NORMAL:\r
-    kind = STRTOG_Normal;\r
-#ifdef  LDBL_IMPLICIT_NBIT\r
-    bits[LDBL_MANT_DIG / 32] |= 1 << ((LDBL_MANT_DIG - 1) % 32);\r
-#endif /* LDBL_IMPLICIT_NBIT */\r
-    break;\r
-  case FP_ZERO:\r
-    kind = STRTOG_Zero;\r
-    break;\r
-  case FP_SUBNORMAL:\r
-    kind = STRTOG_Denormal;\r
-#ifdef  LDBL_IMPLICIT_NBIT\r
-    be++;\r
-#endif\r
-    break;\r
-  case FP_INFINITE:\r
-    kind = STRTOG_Infinite;\r
-    break;\r
-  case FP_NAN:\r
-    kind = STRTOG_NaN;\r
-    break;\r
-  default:\r
-    abort();\r
-  }\r
-\r
-  ret = gdtoa(&fpi, be, (ULong *)bits, &kind, mode, ndigits, decpt, rve);\r
-  if (*decpt == -32768)\r
-    *decpt = INT_MAX;\r
-  return ret;\r
-#else\r
-  return dtoa((double)*ld, mode, ndigits, decpt, sign, rve);\r
-#endif\r
-}\r