]> gitweb.factorcode.org Git - factor.git/blobdiff - core/checksums/crc32/crc32.factor
use radix literals
[factor.git] / core / checksums / crc32 / crc32.factor
index 47da144d4dd6e5a3035805597c109dbf2692cc8a..415317c813c2d01fe1f0068bd1755c34f3c84cc4 100644 (file)
@@ -5,19 +5,19 @@ words io io.binary io.files quotations
 definitions checksums ;
 IN: checksums.crc32
 
-CONSTANT: crc32-polynomial HEX: edb88320
+CONSTANT: crc32-polynomial 0xedb88320
 
 CONSTANT: crc32-table V{ }
 
-256 [
+256 iota [
     8 [
         [ 2/ ] [ even? ] bi [ crc32-polynomial bitxor ] unless
-    ] times >bignum
+    ] times
 ] map 0 crc32-table copy
 
 : (crc32) ( crc ch -- crc )
-    >bignum dupd bitxor
-    mask-byte crc32-table nth-unsafe >bignum
+    dupd bitxor
+    mask-byte crc32-table nth-unsafe
     swap -8 shift bitxor ; inline
 
 SINGLETON: crc32
@@ -25,7 +25,7 @@ SINGLETON: crc32
 INSTANCE: crc32 checksum
 
 : init-crc32 ( input checksum -- x y input )
-    drop [ HEX: ffffffff dup ] dip ; inline
+    drop [ 0xffffffff dup ] dip ; inline
 
 : finish-crc32 ( x y -- bytes )
     bitxor 4 >be ; inline
@@ -33,9 +33,9 @@ INSTANCE: crc32 checksum
 M: crc32 checksum-bytes
     init-crc32
     [ (crc32) ] each
-    finish-crc32 ;
+    finish-crc32 ; inline
 
 M: crc32 checksum-lines
     init-crc32
     [ [ (crc32) ] each CHAR: \n (crc32) ] each
-    finish-crc32 ;
+    finish-crc32 ; inline