diff --git a/module/language/cps/intmap.scm b/module/language/cps/intmap.scm index 7be27c906..152985a06 100644 --- a/module/language/cps/intmap.scm +++ b/module/language/cps/intmap.scm @@ -121,6 +121,9 @@ (match bs (($ 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. diff --git a/module/language/cps/intset.scm b/module/language/cps/intset.scm index b235c61b0..1ec6119cd 100644 --- a/module/language/cps/intset.scm +++ b/module/language/cps/intset.scm @@ -152,6 +152,9 @@ (match bs (($ min shift root) (cond + ((< i 0) + ;; The power-of-two spanning trick doesn't work across 0. + (error "Intsets can only hold non-negative integers." i)) ((not root) ;; Add first element. (let ((min (round-down i shift)))