~ubuntu-branches/ubuntu/precise/classpath/precise

« back to all changes in this revision

Viewing changes to native/jni/java-lang/java_lang_VMDouble.c

  • Committer: Bazaar Package Importer
  • Author(s): Michael Koch
  • Date: 2006-05-27 16:11:15 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20060527161115-h6e39eposdt5snb6
Tags: 2:0.91-3
* Install header files to /usr/include/classpath.
* debian/control: classpath: Conflict with jamvm < 1.4.3 and
  cacao < 0.96 (Closes: #368172).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* VMDouble.c - java.lang.VMDouble native functions
2
 
   Copyright (C) 1998, 1999, 2001, 2003, 2004i, 2005
 
2
   Copyright (C) 1998, 1999, 2001, 2003, 2004, 2005, 2006
3
3
   Free Software Foundation, Inc.
4
4
 
5
5
This file is part of GNU Classpath.
71
71
    {
72
72
      DBG ("unable to get class java.lang.Double\n") return;
73
73
    }
 
74
  clsDouble = (*env)->NewGlobalRef(env, clsDouble);
 
75
  if (clsDouble == NULL)
 
76
    {
 
77
      DBG ("unable to register class java.lang.Double as global ref\n") return;
 
78
    }
74
79
  isNaNID = (*env)->GetStaticMethodID (env, clsDouble, "isNaN", "(D)Z");
75
80
  if (isNaNID == NULL)
76
81
    {
118
123
  jlong e, f;
119
124
  val.d = doubleValue;
120
125
 
 
126
#if defined(__IEEE_BYTES_LITTLE_ENDIAN)
 
127
  /* On little endian ARM processors when using FPA, word order of
 
128
     doubles is still big endian. So take that into account here. When
 
129
     using VFP, word order of doubles follows byte order. */
 
130
 
 
131
#define SWAP_DOUBLE(a)    (((a) << 32) | (((a) >> 32) & 0x00000000ffffffff))
 
132
 
 
133
  val.j = SWAP_DOUBLE(val.j);
 
134
#endif
 
135
 
121
136
  e = val.j & 0x7ff0000000000000LL;
122
137
  f = val.j & 0x000fffffffffffffLL;
123
138
 
139
154
{
140
155
  jvalue val;
141
156
  val.d = doubleValue;
 
157
 
 
158
#if defined(__IEEE_BYTES_LITTLE_ENDIAN)
 
159
  val.j = SWAP_DOUBLE(val.j);
 
160
#endif
 
161
 
142
162
  return val.j;
143
163
}
144
164
 
154
174
{
155
175
  jvalue val;
156
176
  val.j = longValue;
 
177
 
 
178
#if defined(__IEEE_BYTES_LITTLE_ENDIAN)
 
179
  val.j = SWAP_DOUBLE(val.j);
 
180
#endif
 
181
 
157
182
  return val.d;
158
183
}
159
184