+type node_summary = int
+let dummy_summary = -1
+(*
+4444444444443210
+4 -> kind
+3 -> is_left
+2 -> is_right
+1 -> has_left
+0 -> has_right
+*)
+
+let has_right (s : node_summary) : bool =
+ Obj.magic (s land 1)
+let has_left (s : node_summary) : bool =
+ Obj.magic ((s lsr 1) land 1)
+
+let is_right (s : node_summary) : bool =
+ Obj.magic ((s lsr 2) land 1)
+
+let is_left (s : node_summary) : bool =
+ Obj.magic ((s lsr 3) land 1)
+
+let kind (s : node_summary ) : Tree.NodeKind.t =
+ Obj.magic (s lsr 4)
+
+let node_summary is_left is_right has_left has_right kind =
+ ((Obj.magic kind) lsl 4) lor
+ ((Obj.magic is_left) lsl 3) lor
+ ((Obj.magic is_right) lsl 2) lor
+ ((Obj.magic has_left) lsl 1) lor
+ (Obj.magic has_right)
+
+