Ignore:
Timestamp:
Mar 2, 2011, 3:27:41 PM (9 years ago)
Author:
ayache
Message:

Update of D2.2 from Paris.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Deliverables/D2.2/8051/src/common/intValue.mli

    r486 r619  
    11
    2 (** This module defines functions to manipulate integers coded on various number
    3     of bits (sized integers). *)
     2(** This module defines functions to manipulate bounded integers. They can be
     3    used to represent sequences of bits. *)
    44
    55(* Integers, whatever their size, will be represented using the Big_int
     
    99type int_repr = Big_int.big_int
    1010
    11 (* The parameter module. Sized integers are characterized by the number of bits
    12    used to represent them, and the fact that they are signed or not. *)
     11(* The parameter module. Bounded integers are characterized by the number of
     12   bits used to represent them. *)
    1313   
    1414module type INTTYPE =
    1515sig
    16   val size      : int (* in bytes *)
    17   val is_signed : bool
     16  val size : int (* in bytes *)
    1817end
    1918
    20 (* The signature provided to manipulate sized integers. *)
     19(* The signature provided to manipulate bounded integers. *)
    2120
    2221module type S = sig
     
    2928  val one       : t
    3029
    31   val succ   : t -> t
    32   val pred   : t -> t
    33   val add    : t -> t -> t
    34   (** [add_of i1 i2] returns true iff adding the unsigned value of [i1] and the
    35       unsigned value of [i2] overflows. *)
    36   val add_of : t -> t -> bool
    37   val sub    : t -> t -> t
    38   (** [sub_of i1 i2] returns true iff substracting the unsigned value of [i1]
    39       and the unsigned value of [i2] overflows. *)
    40   val sub_of : t -> t -> bool
    41   val mul    : t -> t -> t
    42   val div    : t -> t -> t
    43   val modulo : t -> t -> t
    44   val eq     : t -> t -> bool
    45   val neq    : t -> t -> bool
    46   val lt     : t -> t -> bool
    47   val le     : t -> t -> bool
    48   val gt     : t -> t -> bool
    49   val ge     : t -> t -> bool
    50   val neg    : t -> t
    51   val lognot : t -> t
    52   val logand : t -> t -> t
    53   val logor  : t -> t -> t
    54   val logxor : t -> t -> t
    55   val shl    : t -> t -> t
    56   val shr    : t -> t -> t
    57   val shrl   : t -> t -> t
    58   val max    : t -> t -> t
    59   val min    : t -> t -> t
    60   val cast   : int_repr -> t
    61   val of_int : int -> t
    62   val to_int : t -> int
     30  val succ    : t -> t
     31  val pred    : t -> t
     32  val add     : t -> t -> t
     33  (** [add_of i1 i2] returns [true] iff adding [i1] and [i2] overflows. *)
     34  val add_of  : t -> t -> bool
     35  val sub     : t -> t -> t
     36  (** [sub_uf i1 i2] returns [true] iff substracting [i1] and [i2]
     37      underflows. *)
     38  val sub_uf  : t -> t -> bool
     39  val mul     : t -> t -> t
     40  val div     : t -> t -> t
     41  val divu    : t -> t -> t
     42  val modulo  : t -> t -> t
     43  val modulou : t -> t -> t
     44  val eq      : t -> t -> bool
     45  val neq     : t -> t -> bool
     46  val lt      : t -> t -> bool
     47  val ltu     : t -> t -> bool
     48  val le      : t -> t -> bool
     49  val leu     : t -> t -> bool
     50  val gt      : t -> t -> bool
     51  val gtu     : t -> t -> bool
     52  val ge      : t -> t -> bool
     53  val geu     : t -> t -> bool
     54  val neg     : t -> t
     55  val lognot  : t -> t
     56  val logand  : t -> t -> t
     57  val logor   : t -> t -> t
     58  val logxor  : t -> t -> t
     59  val shl     : t -> t -> t
     60  val shr     : t -> t -> t
     61  val shrl    : t -> t -> t
     62  val max     : t -> t -> t
     63  val maxu    : t -> t -> t
     64  val min     : t -> t -> t
     65  val minu    : t -> t -> t
     66  val cast    : int_repr -> t
     67  val of_int  : int -> t
     68  val to_int  : t -> int
     69
     70  (** [zero_ext n a] performs zero extension on [a] where [n] bits are
     71      significant. *)
     72  val zero_ext : int -> t -> t
     73  (** [sign_ext n a] performs sign extension on [a] where [n] bits are
     74      significant. *)
     75  val sign_ext : int -> t -> t
    6376
    6477  (** [break i n] cuts [i] in [n] parts. In the resulting list, the first
     
    7184end
    7285
    73 (** The functor to create bounded integers from a size and a signedness. *)
     86(** The functor to create bounded integers from a size. *)
    7487
    7588module Make: functor (IntType: INTTYPE) -> S
    7689
     90module Int8  : S
     91module Int16 : S
     92module Int32 : S
     93
     94type int8  = Int8.t
     95type int16 = Int16.t
     96type int32 = Int32.t
     97
     98
     99(*
    77100module Int8s   : S
    78101module Int8u   : S
     
    90113type int32   = Int32.t
    91114type integer = Integer.t
     115*)
Note: See TracChangeset for help on using the changeset viewer.