Note:

You are viewing a development version of the library. Goto the latest version.

let size_compare ?(fuzzy=false) sz1 sz2 = 
  let by1 = 
    byte_of_size sz1
  in
  let by2 = 
    byte_of_size sz2
  in
    if fuzzy then
      (
        let rec fuzzy_comp n1 n2 =
          if n1 = n2 then
            0
          else
            (
              let up_unit_n1 =
                Int64.div n1 1024L
              in
              let up_unit_n2 =
                Int64.div n2 1024L
              in
                if up_unit_n1 <> 0L && up_unit_n2 <> 0L then
                  fuzzy_comp up_unit_n1 up_unit_n2
                else
                  Int64.compare n1 n2
            )
        in
          fuzzy_comp by1 by2
      )
    else
      (
        Int64.compare by1 by2
      )