From 92285b8fb51ac80e07c673c24c7825b9ce4d8d50 Mon Sep 17 00:00:00 2001 From: Vincent St-Amour Date: Wed, 4 Feb 2009 17:25:50 -0500 Subject: [PATCH] Fixed a bug related to negative fixnum encoding (i.e. -1). -1 was casted to unsigned, and became 255, which was then encoded as fixnum. --- picobit-vm.c | 84 +++++++++++++++++++++++------------------------------------- 1 file changed, 32 insertions(+), 52 deletions(-) diff --git a/picobit-vm.c b/picobit-vm.c index 774d3df..f7e91f5 100644 --- a/picobit-vm.c +++ b/picobit-vm.c @@ -1285,15 +1285,15 @@ integer norm (obj prefix, integer n) { if (d <= MAX_FIXNUM) { - n = ENCODE_FIXNUM ((uint8)d); // TODO was fixnum, but was useless and broke stuff - continue; // TODO with cast to unsigned, will it work for negative numbers ? + n = ENCODE_FIXNUM ((uint8)d); // TODO is this cast needed at all ? + continue; // TODO with cast to unsigned, will it work for negative numbers ? or is it only handled in the next branch ? } } else if (obj_eq (n, NEG1)) { if (d >= (1<