From 5a5d2a8dd2c69432a4c70e3821931416e53a6b4e Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Tue, 28 Feb 2012 15:35:28 -0700 Subject: [PATCH] fix JNI float argument passing Floats are implicitly promoted to doubles when passed as part of a variable-length argument list, so we can't treat them the same way as 32-bit integers. --- src/compile.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/compile.cpp b/src/compile.cpp index 25fa2c5ab5..3a4bc7ed63 100644 --- a/src/compile.cpp +++ b/src/compile.cpp @@ -8037,10 +8037,17 @@ class ArgumentList { break; case 'J': - case 'D': addLong(va_arg(arguments, uint64_t)); break; + case 'D': + addLong(doubleToBits(va_arg(arguments, double))); + break; + + case 'F': + addInt(floatToBits(va_arg(arguments, double))); + break; + default: addInt(va_arg(arguments, uint32_t)); break;