* unsigned comparisons on int32, int64, nativeint?
@ 2001-01-18 17:40 Norman Ramsey
2001-01-21 10:37 ` Xavier Leroy
0 siblings, 1 reply; 2+ messages in thread
From: Norman Ramsey @ 2001-01-18 17:40 UTC (permalink / raw)
To: caml-list
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?
Norman
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: unsigned comparisons on int32, int64, nativeint?
2001-01-18 17:40 unsigned comparisons on int32, int64, nativeint? Norman Ramsey
@ 2001-01-21 10:37 ` Xavier Leroy
0 siblings, 0 replies; 2+ messages in thread
From: Xavier Leroy @ 2001-01-21 10:37 UTC (permalink / raw)
To: Norman Ramsey; +Cc: caml-list
> 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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2001-01-21 21:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-01-18 17:40 unsigned comparisons on int32, int64, nativeint? Norman Ramsey
2001-01-21 10:37 ` Xavier Leroy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox