let write_int i str offset =
  String.blit (Printf.sprintf "%04d" i) 0 str offset 4;;