]> gitweb.factorcode.org Git - factor.git/commitdiff
VM: a little faster definition of contains_p()
authorBjörn Lindqvist <bjourne@gmail.com>
Tue, 7 Jun 2016 19:44:56 +0000 (21:44 +0200)
committerBjörn Lindqvist <bjourne@gmail.com>
Tue, 14 Jun 2016 02:40:20 +0000 (04:40 +0200)
vm/bump_allocator.hpp

index dc3339f2eea60a8ee236fef0d1612a046b3c4aae..ba514c101a5b4af2cadad053b8eb554beca5219b 100644 (file)
@@ -10,7 +10,9 @@ struct bump_allocator {
   bump_allocator(cell size, cell start)
       : here(start), start(start), end(start + size), size(size) {}
 
-  bool contains_p(object* obj) { return ((cell)obj - start) < size; }
+  bool contains_p(object* obj) {
+    return (cell)obj >= start && (cell)obj < end;
+  }
 
   object* allot(cell size) {
     cell h = here;