Last change
on this file was 2, checked in by bird, 22 years ago |
Initial revision
|
-
Property cvs2svn:cvs-rev
set to
1.1
-
Property svn:eol-style
set to
native
-
Property svn:executable
set to
*
|
File size:
829 bytes
|
Line | |
---|
1 | // natFloat.cc - Implementation of java.lang.Float native methods.
|
---|
2 |
|
---|
3 | /* Copyright (C) 1998, 1999, 2001 Free Software Foundation
|
---|
4 |
|
---|
5 | This file is part of libgcj.
|
---|
6 |
|
---|
7 | This software is copyrighted work licensed under the terms of the
|
---|
8 | Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
|
---|
9 | details. */
|
---|
10 |
|
---|
11 | #include <config.h>
|
---|
12 |
|
---|
13 | #include <java/lang/Float.h>
|
---|
14 | #include <jvm.h>
|
---|
15 |
|
---|
16 | union u
|
---|
17 | {
|
---|
18 | jint l;
|
---|
19 | jfloat d;
|
---|
20 | };
|
---|
21 |
|
---|
22 | jint
|
---|
23 | java::lang::Float::floatToIntBits(jfloat value)
|
---|
24 | {
|
---|
25 | union u u;
|
---|
26 | u.d = value;
|
---|
27 | jint e = u.l & 0x7f800000;
|
---|
28 | jint f = u.l & 0x007fffff;
|
---|
29 |
|
---|
30 | if (e == 0x7f800000 && f != 0)
|
---|
31 | u.l = 0x7fc00000;
|
---|
32 |
|
---|
33 | return u.l;
|
---|
34 | }
|
---|
35 |
|
---|
36 | jint
|
---|
37 | java::lang::Float::floatToRawIntBits(jfloat value)
|
---|
38 | {
|
---|
39 | union u u;
|
---|
40 | u.d = value;
|
---|
41 | return u.l;
|
---|
42 | }
|
---|
43 |
|
---|
44 | jfloat
|
---|
45 | java::lang::Float::intBitsToFloat(jint bits)
|
---|
46 | {
|
---|
47 | union u u;
|
---|
48 | u.l = bits;
|
---|
49 | return u.d;
|
---|
50 | }
|
---|
51 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.