ref: d664d08a8ed166d3c58b82680950afb9d17dfc8e
parent: 5dbd120154152ae674e01697e6a20ec7f52ba6a4
author: Tor Andersson <tor@ccxvii.net>
date: Thu Mar 13 10:23:30 EDT 2014
Fix compilation of -0.
--- a/jscompile.c
+++ b/jscompile.c
@@ -135,11 +135,13 @@
static void emitnumber(JF, double num)
{
- if (num == 0)
+ if (num == 0) {
emit(J, F, OP_NUMBER_0);
- else if (num == 1)
+ if (signbit(num))
+ emit(J, F, OP_NEG);
+ } else if (num == 1) {
emit(J, F, OP_NUMBER_1);
- else if (num == (short)num) {
+ } else if (num == (short)num) {
emit(J, F, OP_NUMBER_N);
emitraw(J, F, (short)num);
} else {