src/hotspot/share/runtime/sharedRuntimeMath.hpp
author erikj
Tue, 12 Sep 2017 19:03:39 +0200
changeset 47216 71c04702a3d5
parent 25922 hotspot/src/share/vm/runtime/sharedRuntimeMath.hpp@2967d086df71
child 53244 9807daeb47c4
permissions -rw-r--r--
8187443: Forest Consolidation: Move files to unified layout Reviewed-by: darcy, ihse
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
24660
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
     1
/*
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
     2
 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
     4
 *
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
     7
 * published by the Free Software Foundation.
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
     8
 *
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
    13
 * accompanied this code).
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
    14
 *
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
    18
 *
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
    21
 * questions.
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
    22
 *
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
    23
 */
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
    24
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
    25
#ifndef SHARE_VM_RUNTIME_SHAREDRUNTIMEMATH_HPP
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
    26
#define SHARE_VM_RUNTIME_SHAREDRUNTIMEMATH_HPP
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
    27
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
    28
#include <math.h>
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
    29
25919
d4e4f72b49fc 8049043: Load variable through a pointer of an incompatible type in hotspot/src/share/vm/runtime/sharedRuntimeMath.hpp
thartmann
parents: 24660
diff changeset
    30
// Used to access the lower/higher 32 bits of a double
d4e4f72b49fc 8049043: Load variable through a pointer of an incompatible type in hotspot/src/share/vm/runtime/sharedRuntimeMath.hpp
thartmann
parents: 24660
diff changeset
    31
typedef union {
d4e4f72b49fc 8049043: Load variable through a pointer of an incompatible type in hotspot/src/share/vm/runtime/sharedRuntimeMath.hpp
thartmann
parents: 24660
diff changeset
    32
    double d;
d4e4f72b49fc 8049043: Load variable through a pointer of an incompatible type in hotspot/src/share/vm/runtime/sharedRuntimeMath.hpp
thartmann
parents: 24660
diff changeset
    33
    struct {
24660
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
    34
#ifdef VM_LITTLE_ENDIAN
25919
d4e4f72b49fc 8049043: Load variable through a pointer of an incompatible type in hotspot/src/share/vm/runtime/sharedRuntimeMath.hpp
thartmann
parents: 24660
diff changeset
    35
      int lo;
d4e4f72b49fc 8049043: Load variable through a pointer of an incompatible type in hotspot/src/share/vm/runtime/sharedRuntimeMath.hpp
thartmann
parents: 24660
diff changeset
    36
      int hi;
24660
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
    37
#else
25919
d4e4f72b49fc 8049043: Load variable through a pointer of an incompatible type in hotspot/src/share/vm/runtime/sharedRuntimeMath.hpp
thartmann
parents: 24660
diff changeset
    38
      int hi;
d4e4f72b49fc 8049043: Load variable through a pointer of an incompatible type in hotspot/src/share/vm/runtime/sharedRuntimeMath.hpp
thartmann
parents: 24660
diff changeset
    39
      int lo;
24660
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
    40
#endif
25919
d4e4f72b49fc 8049043: Load variable through a pointer of an incompatible type in hotspot/src/share/vm/runtime/sharedRuntimeMath.hpp
thartmann
parents: 24660
diff changeset
    41
    } split;
d4e4f72b49fc 8049043: Load variable through a pointer of an incompatible type in hotspot/src/share/vm/runtime/sharedRuntimeMath.hpp
thartmann
parents: 24660
diff changeset
    42
} DoubleIntConv;
d4e4f72b49fc 8049043: Load variable through a pointer of an incompatible type in hotspot/src/share/vm/runtime/sharedRuntimeMath.hpp
thartmann
parents: 24660
diff changeset
    43
d4e4f72b49fc 8049043: Load variable through a pointer of an incompatible type in hotspot/src/share/vm/runtime/sharedRuntimeMath.hpp
thartmann
parents: 24660
diff changeset
    44
static inline int high(double d) {
25922
2967d086df71 8054054: 8040121 is broken
roland
parents: 25919
diff changeset
    45
  DoubleIntConv x;
2967d086df71 8054054: 8040121 is broken
roland
parents: 25919
diff changeset
    46
  x.d = d;
25919
d4e4f72b49fc 8049043: Load variable through a pointer of an incompatible type in hotspot/src/share/vm/runtime/sharedRuntimeMath.hpp
thartmann
parents: 24660
diff changeset
    47
  return x.split.hi;
d4e4f72b49fc 8049043: Load variable through a pointer of an incompatible type in hotspot/src/share/vm/runtime/sharedRuntimeMath.hpp
thartmann
parents: 24660
diff changeset
    48
}
d4e4f72b49fc 8049043: Load variable through a pointer of an incompatible type in hotspot/src/share/vm/runtime/sharedRuntimeMath.hpp
thartmann
parents: 24660
diff changeset
    49
d4e4f72b49fc 8049043: Load variable through a pointer of an incompatible type in hotspot/src/share/vm/runtime/sharedRuntimeMath.hpp
thartmann
parents: 24660
diff changeset
    50
static inline int low(double d) {
25922
2967d086df71 8054054: 8040121 is broken
roland
parents: 25919
diff changeset
    51
  DoubleIntConv x;
2967d086df71 8054054: 8040121 is broken
roland
parents: 25919
diff changeset
    52
  x.d = d;
25919
d4e4f72b49fc 8049043: Load variable through a pointer of an incompatible type in hotspot/src/share/vm/runtime/sharedRuntimeMath.hpp
thartmann
parents: 24660
diff changeset
    53
  return x.split.lo;
d4e4f72b49fc 8049043: Load variable through a pointer of an incompatible type in hotspot/src/share/vm/runtime/sharedRuntimeMath.hpp
thartmann
parents: 24660
diff changeset
    54
}
d4e4f72b49fc 8049043: Load variable through a pointer of an incompatible type in hotspot/src/share/vm/runtime/sharedRuntimeMath.hpp
thartmann
parents: 24660
diff changeset
    55
d4e4f72b49fc 8049043: Load variable through a pointer of an incompatible type in hotspot/src/share/vm/runtime/sharedRuntimeMath.hpp
thartmann
parents: 24660
diff changeset
    56
static inline void set_high(double* d, int high) {
25922
2967d086df71 8054054: 8040121 is broken
roland
parents: 25919
diff changeset
    57
  DoubleIntConv conv;
2967d086df71 8054054: 8040121 is broken
roland
parents: 25919
diff changeset
    58
  conv.d = *d;
25919
d4e4f72b49fc 8049043: Load variable through a pointer of an incompatible type in hotspot/src/share/vm/runtime/sharedRuntimeMath.hpp
thartmann
parents: 24660
diff changeset
    59
  conv.split.hi = high;
d4e4f72b49fc 8049043: Load variable through a pointer of an incompatible type in hotspot/src/share/vm/runtime/sharedRuntimeMath.hpp
thartmann
parents: 24660
diff changeset
    60
  *d = conv.d;
d4e4f72b49fc 8049043: Load variable through a pointer of an incompatible type in hotspot/src/share/vm/runtime/sharedRuntimeMath.hpp
thartmann
parents: 24660
diff changeset
    61
}
d4e4f72b49fc 8049043: Load variable through a pointer of an incompatible type in hotspot/src/share/vm/runtime/sharedRuntimeMath.hpp
thartmann
parents: 24660
diff changeset
    62
d4e4f72b49fc 8049043: Load variable through a pointer of an incompatible type in hotspot/src/share/vm/runtime/sharedRuntimeMath.hpp
thartmann
parents: 24660
diff changeset
    63
static inline void set_low(double* d, int low) {
25922
2967d086df71 8054054: 8040121 is broken
roland
parents: 25919
diff changeset
    64
  DoubleIntConv conv;
2967d086df71 8054054: 8040121 is broken
roland
parents: 25919
diff changeset
    65
  conv.d = *d;
25919
d4e4f72b49fc 8049043: Load variable through a pointer of an incompatible type in hotspot/src/share/vm/runtime/sharedRuntimeMath.hpp
thartmann
parents: 24660
diff changeset
    66
  conv.split.lo = low;
d4e4f72b49fc 8049043: Load variable through a pointer of an incompatible type in hotspot/src/share/vm/runtime/sharedRuntimeMath.hpp
thartmann
parents: 24660
diff changeset
    67
  *d = conv.d;
d4e4f72b49fc 8049043: Load variable through a pointer of an incompatible type in hotspot/src/share/vm/runtime/sharedRuntimeMath.hpp
thartmann
parents: 24660
diff changeset
    68
}
24660
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
    69
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
    70
static double copysignA(double x, double y) {
25922
2967d086df71 8054054: 8040121 is broken
roland
parents: 25919
diff changeset
    71
  DoubleIntConv convX;
2967d086df71 8054054: 8040121 is broken
roland
parents: 25919
diff changeset
    72
  convX.d = x;
25919
d4e4f72b49fc 8049043: Load variable through a pointer of an incompatible type in hotspot/src/share/vm/runtime/sharedRuntimeMath.hpp
thartmann
parents: 24660
diff changeset
    73
  convX.split.hi = (convX.split.hi & 0x7fffffff) | (high(y) & 0x80000000);
d4e4f72b49fc 8049043: Load variable through a pointer of an incompatible type in hotspot/src/share/vm/runtime/sharedRuntimeMath.hpp
thartmann
parents: 24660
diff changeset
    74
  return convX.d;
24660
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
    75
}
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
    76
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
    77
/*
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
    78
 * ====================================================
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
    79
 * Copyright (c) 1998 Oracle and/or its affiliates. All rights reserved.
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
    80
 *
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
    81
 * Developed at SunSoft, a Sun Microsystems, Inc. business.
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
    82
 * Permission to use, copy, modify, and distribute this
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
    83
 * software is freely granted, provided that this notice
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
    84
 * is preserved.
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
    85
 * ====================================================
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
    86
 */
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
    87
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
    88
/*
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
    89
 * scalbn (double x, int n)
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
    90
 * scalbn(x,n) returns x* 2**n  computed by  exponent
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
    91
 * manipulation rather than by actually performing an
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
    92
 * exponentiation or a multiplication.
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
    93
 */
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
    94
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
    95
static const double
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
    96
two54   =  1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
    97
twom54  =  5.55111512312578270212e-17, /* 0x3C900000, 0x00000000 */
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
    98
hugeX  = 1.0e+300,
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
    99
tiny   = 1.0e-300;
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
   100
25919
d4e4f72b49fc 8049043: Load variable through a pointer of an incompatible type in hotspot/src/share/vm/runtime/sharedRuntimeMath.hpp
thartmann
parents: 24660
diff changeset
   101
static double scalbnA(double x, int n) {
24660
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
   102
  int  k,hx,lx;
25919
d4e4f72b49fc 8049043: Load variable through a pointer of an incompatible type in hotspot/src/share/vm/runtime/sharedRuntimeMath.hpp
thartmann
parents: 24660
diff changeset
   103
  hx = high(x);
d4e4f72b49fc 8049043: Load variable through a pointer of an incompatible type in hotspot/src/share/vm/runtime/sharedRuntimeMath.hpp
thartmann
parents: 24660
diff changeset
   104
  lx = low(x);
24660
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
   105
  k = (hx&0x7ff00000)>>20;              /* extract exponent */
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
   106
  if (k==0) {                           /* 0 or subnormal x */
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
   107
    if ((lx|(hx&0x7fffffff))==0) return x; /* +-0 */
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
   108
    x *= two54;
25919
d4e4f72b49fc 8049043: Load variable through a pointer of an incompatible type in hotspot/src/share/vm/runtime/sharedRuntimeMath.hpp
thartmann
parents: 24660
diff changeset
   109
    hx = high(x);
24660
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
   110
    k = ((hx&0x7ff00000)>>20) - 54;
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
   111
    if (n< -50000) return tiny*x;       /*underflow*/
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
   112
  }
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
   113
  if (k==0x7ff) return x+x;             /* NaN or Inf */
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
   114
  k = k+n;
25919
d4e4f72b49fc 8049043: Load variable through a pointer of an incompatible type in hotspot/src/share/vm/runtime/sharedRuntimeMath.hpp
thartmann
parents: 24660
diff changeset
   115
  if (k > 0x7fe) return hugeX*copysignA(hugeX,x); /* overflow  */
d4e4f72b49fc 8049043: Load variable through a pointer of an incompatible type in hotspot/src/share/vm/runtime/sharedRuntimeMath.hpp
thartmann
parents: 24660
diff changeset
   116
  if (k > 0) {                          /* normal result */
d4e4f72b49fc 8049043: Load variable through a pointer of an incompatible type in hotspot/src/share/vm/runtime/sharedRuntimeMath.hpp
thartmann
parents: 24660
diff changeset
   117
    set_high(&x, (hx&0x800fffff)|(k<<20));
d4e4f72b49fc 8049043: Load variable through a pointer of an incompatible type in hotspot/src/share/vm/runtime/sharedRuntimeMath.hpp
thartmann
parents: 24660
diff changeset
   118
    return x;
d4e4f72b49fc 8049043: Load variable through a pointer of an incompatible type in hotspot/src/share/vm/runtime/sharedRuntimeMath.hpp
thartmann
parents: 24660
diff changeset
   119
  }
24660
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
   120
  if (k <= -54) {
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
   121
    if (n > 50000)      /* in case integer overflow in n+k */
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
   122
      return hugeX*copysignA(hugeX,x);  /*overflow*/
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
   123
    else return tiny*copysignA(tiny,x); /*underflow*/
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
   124
  }
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
   125
  k += 54;                              /* subnormal result */
25919
d4e4f72b49fc 8049043: Load variable through a pointer of an incompatible type in hotspot/src/share/vm/runtime/sharedRuntimeMath.hpp
thartmann
parents: 24660
diff changeset
   126
  set_high(&x, (hx&0x800fffff)|(k<<20));
24660
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
   127
  return x*twom54;
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
   128
}
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
   129
a9b2a80f5afa 8043301: Duplicate definitions in vm/runtime/sharedRuntimeTrans.cpp versus math.h in VS2013
lfoltan
parents:
diff changeset
   130
#endif // SHARE_VM_RUNTIME_SHAREDRUNTIMEMATH_HPP