~mro/geohash

f944d925fe2d10b7afbbf6fe49f5b8121ae5bd0f — Marcus Rohrmoser 3 years ago 221ab40
update dependency

https://codeberg.org/mro/geohash/issues/3
2 files changed, 11 insertions(+), 5 deletions(-)

M lib/calc.ml
M test/calc_test.ml
M lib/calc.ml => lib/calc.ml +9 -2
@@ 22,7 22,14 @@
 * and https://github.com/mmcloughlin/geohash/blob/master/geohash.go 
 * and https://github.com/mmcloughlin/deconstructedgeohash/blob/master/geohash.go *)

open Int63
open Optint.Int63

(*
 * 60 bits are fine, because
 * - ocaml has efficient int63 but not int64
 * - 12 geohash characters equal 60 bit
 * - nobody uses 13 chars = 65 bit
 *)

(* wgs84 -> 30 bit geohash *)
let quantize30 (lat, lng) =


@@ 44,7 51,7 @@ let x0f0f0f0f0f0f0f0f = of_int64 0x0f0f0f0f0f0f0f0fL

let x3333333333333333 = of_int64 0x3333333333333333L

let x5555555555555555 = of_int64 0x3555555555555555L
let x5555555555555555 = of_int64 0x5555555555555555L

let spread x =
  let f s m x' = m |> logand (x' |> logor (shift_left x' s)) in

M test/calc_test.ml => test/calc_test.ml +2 -3
@@ 18,11 18,10 @@
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *)

open Int63
open Optint.Int63
open Lib.Calc

let assert_equals_int64 (test_name : string) (expected : Int63.t)
    (result : Int63.t) : 'a =
let assert_equals_int64 (test_name : string) (expected : t) (result : t) : 'a =
  Assert.assert_equals test_name to_string expected result

(*