]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/alien/endian/endian.factor
factor: trim using lists
[factor.git] / basis / alien / endian / endian.factor
index a7593c05b770a5367ee34831dd151d03a392d159..a8b75c77ae5593a15caac9a437e898313222f1f9 100644 (file)
@@ -1,9 +1,9 @@
 ! Copyright (C) 2011 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors alien.accessors alien.c-types alien.data arrays
-classes.struct.private combinators compiler.units endian fry
-generalizations kernel macros math math.bitwise namespaces
-sequences slots words ;
+classes.struct.private combinators compiler.units endian
+generalizations kernel math math.bitwise namespaces sequences
+slots words ;
 QUALIFIED-WITH: alien.c-types c
 IN: alien.endian
 
@@ -22,7 +22,7 @@ MACRO: byte-reverse ( n signed? -- quot )
     [
         drop
         [
-            dup iota [
+            dup <iota> [
                 [ 1 + - -8 * ] [ nip 8 * ] 2bi
                 '[ _ shift 0xff bitand _ shift ]
             ] with map
@@ -119,6 +119,7 @@ ERROR: unsupported-endian-type endian slot ;
         first2 [ slot>endian-slot ] dip 2array
     ] [
         {
+            { [ dup bool = ] [ 2drop bool ] }
             { [ dup char = ] [ 2drop char ] }
             { [ dup uchar = ] [ 2drop uchar ] }
             { [ dup c:short = ] [ { le16 be16 } endian-slot ] }
@@ -128,6 +129,7 @@ ERROR: unsupported-endian-type endian slot ;
             { [ dup longlong = ] [ { le64 be64 } endian-slot ] }
             { [ dup ulonglong = ] [ { ule64 ube64 } endian-slot ] }
             { [ dup endian-c-type? ] [ nip ] }
+            { [ dup pointer? ] [ nip ] }
             [ unsupported-endian-type ]
         } cond
     ] if ;