is it fp or just assembler?
source
open Thrift
module P = Protocol
let get_byte i b = 255 land (i lsr (8*b))
let get_byte64 i b = 255 land (Int64.to_int (Int64.shift_right i (8*b)))
let tv = P.t_type_to_i
let vt = P.t_type_of_i
let comp_int b n =
let s = ref 0l in
let sb = 32 - 8*n in
for i=0 to (n-1) do
s:= Int32.logor !s (Int32.shift_left (Int32.of_int (int_of_char b.[i])) (8*(n-1-i)))
done;
Int32.to_int (Int32.shift_right (Int32.shift_left !s sb) sb)
( Read more... )