[m-dev.] for review: int__xor

Simon Taylor stayl at cs.mu.OZ.AU
Tue Oct 26 10:59:36 AEST 1999


Estimated hours taken: 0.1

Prepare for using `^' for record syntax rather than xor.

library/int.m:
	Add function `int__xor/2' as a replacement for `'^'/2'.

compiler/code_util.m:
	Recognise `int__xor/2' as a builtin.



Index: library/int.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/int.m,v
retrieving revision 1.60
diff -u -u -r1.60 int.m
--- int.m	1999/09/27 05:31:50	1.60
+++ int.m	1999/10/25 00:23:57
@@ -155,6 +155,12 @@
 :- mode in  \/ in  = uo  is det.
 
 	% bitwise exclusive or (xor)
+:- func int__xor(int, int) = int.
+:- mode int__xor(in, in) = uo is det.
+
+	% bitwise exclusive or (xor)
+	% This version will be removed soon - the operator
+	% is needed for record syntax.
 :- func int ^ int = int.
 :- mode in  ^ in  = uo  is det.
 
@@ -265,6 +271,8 @@
 
 % Most of the arithmetic and comparison operators are recognized by
 % the compiler as builtins, so we don't need to define them here.
+
+:- external(int__xor/2).
 
 X div Y = Div :-
 	Trunc = X // Y,
Index: compiler/code_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/code_util.m,v
retrieving revision 1.113
diff -u -u -r1.113 code_util.m
--- code_util.m	1999/10/25 03:48:40	1.113
+++ code_util.m	1999/10/25 06:36:53
@@ -485,6 +485,8 @@
 	no, yes(Z - binop((^), var(X), var(Y)))).
 code_util__translate_builtin_2("int", "^", 0, [X, Y, Z],
 	no, yes(Z - binop((^), var(X), var(Y)))).
+code_util__translate_builtin_2("int", "xor", 0, [X, Y, Z],
+	no, yes(Z - binop((^), var(X), var(Y)))).
 code_util__translate_builtin_2("int", "builtin_unary_plus", 0, [X, Y],
 	no, yes(Y - var(X))).
 code_util__translate_builtin_2("int", "+", 0, [X, Y],
--------------------------------------------------------------------------
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