[m-rev.] diff: add more builtin ops on uints (part 2)

Julien Fischer jfischer at opturion.com
Tue Apr 18 11:43:33 AEST 2017


The first part of this was committed last week; you will
need to ensure you are using rotd-2017-04-11 or later.

-----------------------------


Add more builtin ops on uints (part 2).

library/uint.m:
     Uncomment the reverse modes for addition and subtraction.

     Add unchecked_{left,right}_shift.

Julien.

diff --git a/library/uint.m b/library/uint.m
index 9ebda44..89ae643 100644
--- a/library/uint.m
+++ b/library/uint.m
@@ -55,15 +55,15 @@
      %
  :- func uint + uint = uint.
  :- mode in   + in  = uo is det.
-%:- mode uo   + in  = in is det.
-%:- mode in   + uo  = in is det.
+:- mode uo   + in  = in is det.
+:- mode in   + uo  = in is det.

      % Subtraction.
      %
  :- func uint - uint = uint.
  :- mode in   - in   = uo is det.
-%:- mode uo   - in   = in is det.
-%:- mode in   - uo   = in is det.
+:- mode uo   - in   = in is det.
+:- mode in   - uo   = in is det.

      % Multiplication.
      %
@@ -81,6 +81,10 @@

  :- func unchecked_rem(uint::in, uint::in) = (uint::uo) is det.

+:- func unchecked_left_shift(uint::in, int::in) = (uint::uo) is det.
+
+:- func unchecked_right_shift(uint::in, int::in) = (uint::uo) is det.
+
      % even(X) is equivalent to (X mod 2 = 0).
      %
  :- pred even(uint::in) is semidet.


More information about the reviews mailing list