[MLton-commit] r5263

Vesa Karvonen vesak at mlton.org
Mon Feb 19 06:42:21 PST 2007


Starting work on concept signatures.
----------------------------------------------------------------------

A   mltonlib/trunk/com/ssh/extended-basis/unstable/public/concept/
A   mltonlib/trunk/com/ssh/extended-basis/unstable/public/concept/bitwise.sig

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

Added: mltonlib/trunk/com/ssh/extended-basis/unstable/public/concept/bitwise.sig
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/public/concept/bitwise.sig	2007-02-19 14:34:59 UTC (rev 5262)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/public/concept/bitwise.sig	2007-02-19 14:42:21 UTC (rev 5263)
@@ -0,0 +1,45 @@
+(* Copyright (C) 2007 SSH Communications Security, Helsinki, Finland
+ *
+ * This code is released under the MLton license, a BSD-style license.
+ * See the LICENSE file or http://mlton.org/License for details.
+ *)
+
+(**
+ * A bitwise operable type can be treated as a sequence of bits.  The
+ * sequence of bits may be finite or infinite.  In an infinite sequence,
+ * the most significant (or leftmost) bits are either all zeros or all
+ * ones.  Zero extending shift operator, {>>}, does not work with such
+ * infinite bit sequences and is not specified.
+ *)
+signature BITWISE = sig
+   type bitwise
+
+   val andb : bitwise BinOp.t
+   (** Returns the bitwise AND of the arguments. *)
+
+   val notb : bitwise UnOp.t
+   (**
+    * Returns the bitwise complement NOT of the argument.  When values are
+    * interpreted as two's complement integers {notb i = ~(i + 1)}.
+    *)
+
+   val orb : bitwise BinOp.t
+   (** Returns the bitwise OR of the arguments. *)
+
+   val xorb : bitwise BinOp.t
+   (** Returns the bitwise exclusive OR of the arguments. *)
+
+   val << : bitwise ShiftOp.t
+   (**
+    * {i << n} shifts {i} to the left by {n} bit positions, filling in
+    * zeros from the right.  When {i} and {n} are interpreted as integers,
+    * the latter non-negative, this returns {i * 2^n}.
+    *)
+
+   val ~>> : bitwise ShiftOp.t
+   (**
+    * {i ~>> n} shifts {i} to the right by {n} bit positions.  When {i}
+    * and {n} are interpreted as integers, the latter non-negative, this
+    * returns {floor (i / 2^n)}.
+    *)
+end


Property changes on: mltonlib/trunk/com/ssh/extended-basis/unstable/public/concept/bitwise.sig
___________________________________________________________________
Name: svn:eol-style
   + native




More information about the MLton-commit mailing list