Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Need unsigned int
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Nicolas Cannasse <warplayer@f...>
Subject: Re: [Caml-list] Need unsigned int
> > let ui_compare x y =
> >     x lsr 16 < y lsr 16 || x land 0xFFFF < y land 0xFFFF
> 
> Watch out !  This definition is wrong.
> 

My fault !
Sometimes my keyboard is writing faster than my brain is thinking :)

Someting like :

let ui_compare x y =
    match x lsr 16 - y lsr 16 with
    | 0 -> x land 0xFFFF < y land 0xFFFF
    | n when n > 0 -> false
    | _ ->  true

Should be okay

Nicolas Cannasse

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners