[m-dev.] diff: fix bug in bytecode_data.m
Fergus Henderson
fjh at cs.mu.OZ.AU
Thu May 27 18:14:46 AEST 1999
On 27-May-1999, Simon Taylor <stayl at cs.mu.OZ.AU> wrote:
>
> Estimated hours taken: 0.1
>
> compiler/bytecode_data.m:
> Fix a bug in checking whether a negative integer
> fits in a certain number of bits. There isn't a
> test case for this because the integer sizes less than
> a word are only ever used for positive numbers.
>
> Index: bytecode_data.m
> ===================================================================
> RCS file: /home/staff/zs/imp/mercury/compiler/bytecode_data.m,v
> retrieving revision 1.2
> diff -u -u -r1.2 bytecode_data.m
> --- bytecode_data.m 1999/03/10 00:01:42 1.2
> +++ bytecode_data.m 1999/03/24 03:00:16
> @@ -142,7 +142,10 @@
> { int__bits_per_int(IntBits) },
> {
> Bits < IntBits,
> - (IntVal /\ (\0 << Bits)) \= 0
> + int__pow(2, Bits, MaxVal),
> + ( IntVal >= MaxVal
> + ; IntVal < -MaxVal
> + )
> ->
> string__format(
> "error: bytecode_data__output_int: %d does not fit in %d bits",
Shouldn't MaxVal be `2 ** (Bits - 1)' rather than `2 ** Bits'?
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3 | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to: mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions: mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------
More information about the developers
mailing list