]> gitweb.factorcode.org Git - factor.git/commitdiff
cuckoo-filters: using alien deref in tag-index.
authorJohn Benediktsson <mrjbq7@gmail.com>
Mon, 8 Aug 2016 22:18:36 +0000 (15:18 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Mon, 8 Aug 2016 22:18:36 +0000 (15:18 -0700)
extra/cuckoo-filters/cuckoo-filters.factor

index e64b12115d17b0bf2615a6cd5477a4490067d40d..ffa965904bbdbfa4723e663e1490a817fa7921dd 100644 (file)
@@ -1,8 +1,8 @@
 ! Copyright (C) 2016 John Benediktsson
 ! See http://factorcode.org/license.txt for BSD license
 
-USING: accessors arrays checksums checksums.sha
-combinators.short-circuit io.binary kernel locals math
+USING: accessors alien alien.c-types alien.data arrays checksums
+checksums.sha combinators.short-circuit kernel locals math
 math.bitwise random sequences ;
 
 IN: cuckoo-filters
@@ -27,7 +27,7 @@ CONSTANT: bucket-size 4
     #buckets [ bucket-size f <array> ] replicate ;
 
 : tag-index ( hash -- tag index )
-    4 cut 4 head [ be> ] bi@ ;
+    4 over <displaced-alien> [ uint deref ] bi@ ;
 
 : alt-index ( tag index -- altindex )
     [ 0x5bd1e995 w* ] [ bitxor ] bi* ;