natVMFloat.cc 882 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // natVMFloat.cc - Implementation of java.lang.VMFloat native methods.
  2. /* Copyright (C) 1998, 1999, 2001, 2006, 2007 Free Software Foundation
  3. This file is part of libgcj.
  4. This software is copyrighted work licensed under the terms of the
  5. Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
  6. details. */
  7. #include <config.h>
  8. #include <java/lang/Float.h>
  9. #include <java/lang/VMFloat.h>
  10. #include <jvm.h>
  11. union u
  12. {
  13. jint l;
  14. jfloat d;
  15. };
  16. jint
  17. java::lang::VMFloat::floatToIntBits(jfloat value)
  18. {
  19. union u u;
  20. u.d = value;
  21. jint e = u.l & 0x7f800000;
  22. jint f = u.l & 0x007fffff;
  23. if (e == 0x7f800000 && f != 0)
  24. u.l = 0x7fc00000;
  25. return u.l;
  26. }
  27. jint
  28. java::lang::VMFloat::floatToRawIntBits(jfloat value)
  29. {
  30. union u u;
  31. u.d = value;
  32. return u.l;
  33. }
  34. jfloat
  35. java::lang::VMFloat::intBitsToFloat(jint bits)
  36. {
  37. union u u;
  38. u.l = bits;
  39. return u.d;
  40. }