]> git.proxmox.com Git - mirror_edk2.git/blobdiff - AppPkg/Applications/ArithChk/arithchk.c
edk2: Remove AppPkg, StdLib, StdLibPrivateInternalFiles
[mirror_edk2.git] / AppPkg / Applications / ArithChk / arithchk.c
diff --git a/AppPkg/Applications/ArithChk/arithchk.c b/AppPkg/Applications/ArithChk/arithchk.c
deleted file mode 100644 (file)
index 9fea71f..0000000
+++ /dev/null
@@ -1,197 +0,0 @@
-/** @file\r
-    Program to generate an arith.h for use with the gdtoa binary to decimal and decimal to binary\r
-    conversion library.\r
-\r
-  Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>\r
-  This program and the accompanying materials\r
-  are licensed and made available under the terms and conditions of the BSD License\r
-  which accompanies this distribution. The full text of the license may be found at\r
-  http://opensource.org/licenses/bsd-license.\r
-\r
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-  Copyright (C) 1997, 1998 Lucent Technologies\r
-  All Rights Reserved\r
-\r
-  Permission to use, copy, modify, and distribute this software and\r
-  its documentation for any purpose and without fee is hereby\r
-  granted, provided that the above copyright notice appear in all\r
-  copies and that both that the copyright notice and this\r
-  permission notice and warranty disclaimer appear in supporting\r
-  documentation, and that the name of Lucent or any of its entities\r
-  not be used in advertising or publicity pertaining to\r
-  distribution of the software without specific, written prior\r
-  permission.\r
-\r
-  LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,\r
-  INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.\r
-  IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY\r
-  SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\r
-  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER\r
-  IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,\r
-  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF\r
-  THIS SOFTWARE.\r
-\r
-  NetBSD: arithchk.c,v 1.2 2006/01/25 15:27:42 kleink Exp\r
-****************************************************************/\r
-#include  <sys/EfiCdefs.h>\r
-\r
-/* Try to deduce arith.h from arithmetic properties. */\r
-\r
-#include <stdio.h>\r
-\r
-static int dalign;\r
-\r
-typedef struct  Akind {\r
-  char *name;\r
-  int   kind;\r
-} Akind;\r
-\r
-static Akind  IEEE_LITTLE_ENDIAN  = { "IEEE_LITTLE_ENDIAN", 1 };\r
-static Akind  IEEE_BIG_ENDIAN     = { "IEEE_BIG_ENDIAN", 2 };\r
-static Akind  IBM                 = { "IBM", 3 };\r
-static Akind  VAX                 = { "VAX", 4 };\r
-static Akind  CRAY                = { "CRAY", 5};\r
-\r
-static Akind *\r
-Lcheck()\r
-{\r
-  union {\r
-    double d;\r
-    long L[2];\r
-  } u;\r
-  struct {\r
-    double d;\r
-    long L;\r
-  } x[2];\r
-\r
-  if (sizeof(x) > 2*(sizeof(double) + sizeof(long)))\r
-    dalign = 1;\r
-  u.L[0] = u.L[1] = 0;\r
-  u.d = 1e13;\r
-  if (u.L[0] == 1117925532 && u.L[1] == -448790528)\r
-    return &IEEE_BIG_ENDIAN;\r
-  if (u.L[1] == 1117925532 && u.L[0] == -448790528)\r
-    return &IEEE_LITTLE_ENDIAN;\r
-  if (u.L[0] == -2065213935 && u.L[1] == 10752)\r
-    return &VAX;\r
-  if (u.L[0] == 1267827943 && u.L[1] == 704643072)\r
-    return &IBM;\r
-  return 0;\r
-  }\r
-\r
- static Akind *\r
-icheck()\r
-{\r
-  union {\r
-    double d;\r
-    int L[2];\r
-    } u;\r
-  struct {\r
-    double d;\r
-    int L;\r
-    } x[2];\r
-\r
-  if (sizeof(x) > 2*(sizeof(double) + sizeof(int)))\r
-    dalign = 1;\r
-  u.L[0] = u.L[1] = 0;\r
-  u.d = 1e13;\r
-  if (u.L[0] == 1117925532 && u.L[1] == -448790528)\r
-    return &IEEE_BIG_ENDIAN;\r
-  if (u.L[1] == 1117925532 && u.L[0] == -448790528)\r
-    return &IEEE_LITTLE_ENDIAN;\r
-  if (u.L[0] == -2065213935 && u.L[1] == 10752)\r
-    return &VAX;\r
-  if (u.L[0] == 1267827943 && u.L[1] == 704643072)\r
-    return &IBM;\r
-  return 0;\r
-  }\r
-\r
-char *emptyfmt = "";  /* avoid possible warning message with printf("") */\r
-\r
- static Akind *\r
-ccheck()\r
-{\r
-  union {\r
-    double d;\r
-    long L;\r
-    } u;\r
-  long Cray1;\r
-\r
-  /* Cray1 = 4617762693716115456 -- without overflow on non-Crays */\r
-  Cray1 = printf(emptyfmt) < 0 ? 0 : 4617762;\r
-  if (printf(emptyfmt, Cray1) >= 0)\r
-    Cray1 = 1000000*Cray1 + 693716;\r
-  if (printf(emptyfmt, Cray1) >= 0)\r
-    Cray1 = 1000000*Cray1 + 115456;\r
-  u.d = 1e13;\r
-  if (u.L == Cray1)\r
-    return &CRAY;\r
-  return 0;\r
-  }\r
-\r
- static int\r
-fzcheck()\r
-{\r
-  double a, b;\r
-  int i;\r
-\r
-  a = 1.;\r
-  b = .1;\r
-  for(i = 155;; b *= b, i >>= 1) {\r
-    if (i & 1) {\r
-      a *= b;\r
-      if (i == 1)\r
-        break;\r
-      }\r
-    }\r
-  b = a * a;\r
-  return b == 0.;\r
-  }\r
-\r
- int\r
-main()\r
-{\r
-  Akind *a = 0;\r
-  int Ldef = 0;\r
-  FILE *f;\r
-\r
-#ifdef WRITE_ARITH_H  /* for Symantec's buggy "make" */\r
-  f = fopen("arith.h", "w");\r
-  if (!f) {\r
-    printf("Cannot open arith.h\n");\r
-    return 1;\r
-    }\r
-#else\r
-  f = stdout;\r
-#endif\r
-\r
-  if (sizeof(double) == 2*sizeof(long))\r
-    a = Lcheck();\r
-  else if (sizeof(double) == 2*sizeof(int)) {\r
-    Ldef = 1;\r
-    a = icheck();\r
-    }\r
-  else if (sizeof(double) == sizeof(long))\r
-    a = ccheck();\r
-  if (a) {\r
-    fprintf(f, "#define %s\n#define Arith_Kind_ASL %d\n",\r
-      a->name, a->kind);\r
-    if (Ldef)\r
-      fprintf(f, "#define Long int\n#define Intcast (int)(long)\n");\r
-    if (dalign)\r
-      fprintf(f, "#define Double_Align\n");\r
-    if (sizeof(char*) == 8)\r
-      fprintf(f, "#define X64_bit_pointers\n");\r
-#ifndef NO_LONG_LONG\r
-    if (sizeof(long long) < 8)\r
-#endif\r
-      fprintf(f, "#define NO_LONG_LONG\n");\r
-    if (a->kind <= 2 && fzcheck())\r
-      fprintf(f, "#define Sudden_Underflow\n");\r
-    return 0;\r
-    }\r
-  fprintf(f, "/* Unknown arithmetic */\n");\r
-  return 1;\r
-  }\r