jan_flanders

Untitled

Dec 19th, 2012
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
OCaml 0.39 KB | None | 0 0
  1. (* ttf.ml: *)
  2. let _nbits x =
  3.     if x = 0 then
  4.         0
  5.     else
  6.         let x = ref x in
  7.         if !x < 0 then x := -1 * !x;
  8.         let nbits = ref 0 in
  9.         while !x > 0 do
  10.             x := !x lsr 1;
  11.             incr nbits;
  12.         done;
  13.         !nbits
  14. (* ------------------------------------- *)
  15. (* swfparser.ml: *)
  16. let do_something_terrible_to_v n v
  17.     v & ((1 << n ) - 1);
  18.  
  19. let write_bits n v = write_bits n (do_something_terrible_to_v n v)
Advertisement
Add Comment
Please, Sign In to add comment