[m-dev.] for review: int__xor

Fergus Henderson fjh at cs.mu.OZ.AU
Mon Nov 1 12:56:36 AEDT 1999


On 01-Nov-1999, Simon Taylor <stayl at cs.mu.OZ.AU> wrote:
> 
> 
> Make `int:^/2' obsolete.

To make it easier for people to bootstrap this change,
you should do a `cvs rtag bootstrap_<date>_xor'
before committing this change, and the log message
for the change should mention the tag name.

> --- const_prop.m	1999/04/23 01:02:35	1.10
> +++ const_prop.m	1999/10/31 23:01:27
> @@ -244,7 +244,12 @@
>  evaluate_builtin_tri("int", "^", 0, X, Y, Z, Z, int_const(ZVal)) :-
>  	X = _XVar - bound(_XUniq, [functor(int_const(XVal), [])]),
>  	Y = _YVar - bound(_YUniq, [functor(int_const(YVal), [])]),
> -	ZVal is XVal ^ YVal.
> +	ZVal = int__xor(XVal, YVal).

You might want to consider writing that as

	ZVal = XVal `xor` YVal.

> +++ string.m	1999/10/31 23:03:06
> @@ -752,7 +752,7 @@
>  	string__length(String, Length),
>  	string__to_int_list(String, CodeList),
>  	string__hash_2(CodeList, 0, HashVal0),
> -	HashVal is HashVal0 ^ Length.
> +	HashVal = int__xor(HashVal0, Length).
>  
>  :- pred string__hash_2(list(int), int, int).
>  :- mode string__hash_2(in, in, out) is det.
> @@ -766,9 +766,9 @@
>  :- mode string__combine_hash(in, in, out) is det.
>  
>  string__combine_hash(H0, X, H) :-
> -	H1 is H0 << 5,
> -	H2 is H1 ^ H0,
> -	H is H2 ^ X.
> +	H1 = H0 << 5,
> +	H2 = int__xor(H1, H0),
> +	H = int__xor(H2, X).

Likewise here.

Apart from that, this change looks fine.

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