Advertisement
Guest User

Untitled

a guest
Oct 2nd, 2015
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. open Netsys
  2. open Printf
  3.  
  4. let show s = print_string (s^"\n")
  5. let to4 x = Netnumber.uint4_of_int x
  6. let toi x = Netnumber.int_of_uint4 x
  7.  
  8. let test a b =
  9. printf "%i <? %i\n" a b;
  10. printf "as int : %b\n" (a < b);
  11. printf "as uint4 : %b\n" (Netnumber.lt_uint4 (to4 a) (to4 b));
  12. printf "\n"
  13.  
  14. let () =
  15. (*ignore (Netsys.string_of_sockaddr (Obj.magic 0));*)
  16. test 3422617600 4294967287; (* >> 2^31 * 2 *)
  17. test 2147483647 4294967287; (* 2^31-1, >> 2^31 *)
  18. test 2147483648 2147483649; (* 2^31, 2^31+1 *)
  19. test 2147483648 4294967295 (* 2 ^ 31, 2^32-1 *)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement