Restrict intsets and maps to non-negative integers
[bpt/guile.git] / module / language / cps / intmap.scm
index 7be27c9..152985a 100644 (file)
   (match bs
     (($ <intmap> min shift root)
      (cond
+      ((< i 0)
+       ;; The power-of-two spanning trick doesn't work across 0.
+       (error "Intmaps can only map non-negative integers." i))
       ((not val) (intmap-remove bs i))
       ((not root)
        ;; Add first element.