bug in bytecode.m

Fergus Henderson fjh at cs.mu.oz.au
Wed Mar 19 05:50:47 AEDT 1997


Hi,

The following code is buggy:

	:- pred output_int(int, io__state, io__state).
	:- mode output_int(in, di, uo) is det.

	output_int(Val) -->
		{ Val1 is Val >> 24 },
		{ Val2 is Val >> 16 mod 256 },
		{ Val3 is Val >> 8 mod 256 },
		{ Val4 is Val mod 256 },
		( { Val1 < 256 } ->
			io__write_byte(Val1),
			io__write_byte(Val2),
			io__write_byte(Val3),
			io__write_byte(Val4)
		;
			{ error("integer does not fit in thirtytwo bits") }
		).

What if `Val' is e.g. -(2^37) ?

Zoltan, can you please fix this one?

-- 
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.



More information about the developers mailing list