caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Xavier Leroy <Xavier.Leroy@inria.fr>
To: Norman Ramsey <nr@eecs.harvard.edu>
Cc: caml-list@inria.fr
Subject: Re: unsigned comparisons on int32, int64, nativeint?
Date: Sun, 21 Jan 2001 11:37:07 +0100	[thread overview]
Message-ID: <20010121113707.B13901@pauillac.inria.fr> (raw)
In-Reply-To: <200101181740.MAA28644@labrador.eecs.harvard.edu>; from nr@eecs.harvard.edu on Thu, Jan 18, 2001 at 12:40:36PM -0500

> I have sought but not found unsigned comparisons on the integer types
> int32, int64, and nativeint.  I especially need `unsigned less than'.
> Where might I find bindings for these operations?

In a pinch, you can always use signed compares after shifting the
arguments by min_int, e.g.:

let ule_int32 a b = Int32.add a Int32.min_int <= Int32.add b Int32.min_int

(I have a very strong feeling that it should work, but no doubt
expert bit-twiddlers on this list will correct me if it doesn't.)

The code generated for this is nowhere as efficient as a
processor-native unsigned comparison, though.  

- Xavier Leroy



      reply	other threads:[~2001-01-21 21:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-01-18 17:40 Norman Ramsey
2001-01-21 10:37 ` Xavier Leroy [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010121113707.B13901@pauillac.inria.fr \
    --to=xavier.leroy@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=nr@eecs.harvard.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).