Re: Unsigned integers?

From: Jean-Christophe Filliatre (filliatr@csl.sri.com)
Date: Wed Mar 22 2000 - 18:05:01 MET

  • Next message: Toby Moth: "RE: Syntax for label, NEW SOLUTION"

    In his message of Wed March 22, 2000, John Max Skaller writes:
    >
    > Unfortunately, caml integers are signed, which makes most of the
    > code I have written wrong (I haven't taken the care to handle
    > integers over 2^30 correctly).
    >
    > What is the best way to handle this problem?
    > Would a (standard?) library module (written in C), that treats
    > integers as unsigned be a reasonable solution?

    I wrote such a C library to handle (boxed) 32 or 64 bits integers (you
    can find it on my web page). But it appeared that it was not very
    efficient, and when I rewrote my program using an encoding with two
    Caml integers, it was really faster.

    So I would suggest you to write such a library in Caml. For a good
    starting point, you may have a look at the module Nativeint in ocaml
    sources (in utils/nativeint.ml).

    Best regards,

    -- 
    Jean-Christophe Filliatre    
      Computer Science Laboratory   Phone (650) 859-5173
      SRI International             FAX   (650) 859-2844
      333 Ravenswood Ave.           email  filliatr@csl.sri.com
      Menlo Park, CA 94025, USA     web    http://www.csl.sri.com/~filliatr
    



    This archive was generated by hypermail 2b29 : Wed Mar 22 2000 - 19:25:25 MET