         [ dup byte-array? ] [ f ] if
     ] 2dip if ; inline
 
-: 1be> ( bytes -- x )
+: 1be> ( seq -- x )
     big-endian [ uint8_t deref ] [ 1 n-be> ] if-endian ;
 
-: 2be> ( bytes -- x )
+: 2be> ( seq -- x )
     big-endian [ uint16_t deref ] [ 2 n-be> ] if-endian ;
 
-: 4be> ( bytes -- x )
+: 4be> ( seq -- x )
     big-endian [ uint32_t deref ] [ 4 n-be> ] if-endian ;
 
-: 8be> ( bytes -- x )
+: 8be> ( seq -- x )
     big-endian [ uint64_t deref ] [ 8 n-be> ] if-endian ;
 
-: 1le> ( bytes -- x )
+: 1le> ( seq -- x )
     little-endian [ uint8_t deref ] [ 1 n-le> ] if-endian ;
 
-: 2le> ( bytes -- x )
+: 2le> ( seq -- x )
     little-endian [ uint16_t deref ] [ 2 n-le> ] if-endian ;
 
-: 4le> ( bytes -- x )
+: 4le> ( seq -- x )
     little-endian [ uint32_t deref ] [ 4 n-le> ] if-endian ;
 
-: 8le> ( bytes -- x )
+: 8le> ( seq -- x )
     little-endian [ uint64_t deref ] [ 8 n-le> ] if-endian ;
 
 PRIVATE>
 
-: be> ( bytes -- x )
+: be> ( seq -- x )
     dup length {
         { 1 [ 1be> ] }
         { 2 [ 2be> ] }


PRIVATE>

: >le ( x n -- bytes )
    compute-native-endianness little-endian = [
        {
            { 2 [ int16_t <ref> ] }


M: little-endian endian> le> ;

HOOK: unsigned-endian> endianness ( seq -- n )

M: big-endian unsigned-endian> be> ;

M: little-endian unsigned-endian> le> ;

HOOK: signed-endian> endianness ( seq -- n )

M: big-endian signed-endian> signed-be> ;

