        (>= r-cnum (elt (elt node 1) 3))))
 
 (defun caml-types-find-location (targ-pos curr node)
+  (if (not (caml-types-pos-inside targ-pos node))
+      curr
+    (if (elt node 2)
+        (setq curr node))
+    (let ((i (caml-types-search node targ-pos)))
+      (if (and (> i 3)
+               (caml-types-pos-inside targ-pos (elt node (1- i))))
+          (caml-types-find-location targ-pos curr (elt node (1- i)))
+        curr))))
+
+; trouve le premier fils qui commence apres la position
+; ou (length node) si tous commencent avant
+;(defun caml-types-search (node pos)
+;  (let ((min 3)
+;        (max (length node))
+;        med)
+;    (while (< min max)
+;      (setq med (/ (+ min max) 2))
+;      (if (caml-types-pos<= (elt (elt node med) 0) pos)
+;          (setq min (1+ med))
+;        (setq max med)))
+;    min))
+
+; a remplacer par une dichotomie
+(defun caml-types-search (node pos)
   (let ((i 3))
-    (if (not (caml-types-pos-inside targ-pos node))
-        curr
-      (while (and (< i (length node))
-                  (not (caml-types-pos-inside targ-pos (elt node i))))
-        (setq i (1+ i)))
-      (if (elt node 2)
-          (setq curr node))
-      (if (< i (length node))
-          (caml-types-find-location targ-pos curr (elt node i))
-        curr))))
+    (while (and (< i (length node))
+                (caml-types-pos<= (elt (elt node i) 0) targ-pos))
+      (setq i (1+ i)))
+    i))
 
 (defun caml-types-pos-inside (pos node)
   (let ((left-pos (elt node 0))

;  () if this node does not correspond to an annotated interval
;  (type-start . type-end)  address of the annotation in the .annot file

(defun caml-types-build-tree ()
  (let ((stack ())
        (accu ())
        (type-info ()))

      (delete-overlay caml-types-expr-ovl))))

(defun caml-types-preprocess (type-file type-buf)
  (let* ((type-date (nth 5 (file-attributes type-file)))
         (target-file (file-name-nondirectory (buffer-file-name)))
         (target-date (nth 5 (file-attributes target-file))))
    (unless (and caml-types-annotation-tree
                 (not (caml-types-date< caml-types-annotation-date type-date)))
      (if (caml-types-date< type-date target-date)
