1 2 3 4 5 6 7 8 9
| type quadtree =
* | Base of int * int * int array array
* | Node of int * int * quadnode
* and quadnode = quadtree array;;
let hash qn = match qn with
* * | [|Base (dno, hno, ano); Base (dne, hne, ane); Base (dso, hso, aso); Base (dse, hse, ase)|] -> (hno lsl 12) lor (hne lsl 8) lor (hso lsl 4) lor hse
* * | [|Node (dno, hno, ano); Node (dne, hne, ane); Node (dso, hso, aso); Node (dse, hse, ase)|] -> (hno lsl 16 lor hno) + (hne lsl 8 lor hne) + (hso lsl 4 lor hso) + (hse lsl 2 lor hse)
* * | _ -> failwith "Hash";; |
Partager