X-Git-Url: https://gitweb.factorcode.org/gitweb.cgi?p=factor.git;a=blobdiff_plain;f=core%2Fio%2Fbinary%2Fbinary.factor;h=793fe0686ae72a846e1dcdd42746f24f855f2e7a;hp=5d416400e64f6b52ea818af3c5979d9f3827cd2c;hb=943596575ad294c074dfa381b70af74dba5992b1;hpb=e738c7206c32bd9b76f3cee31e950835e1b1ee24 diff --git a/core/io/binary/binary.factor b/core/io/binary/binary.factor index 5d416400e6..793fe0686a 100644 --- a/core/io/binary/binary.factor +++ b/core/io/binary/binary.factor @@ -6,7 +6,7 @@ IN: io.binary : le> ( seq -- x ) dup length iota 0 [ 8 * shift + ] 2reduce ; : be> ( seq -- x ) 0 [ [ 8 shift ] dip + ] reduce ; -: mask-byte ( x -- y ) HEX: ff bitand ; inline +: mask-byte ( x -- y ) 0xff bitand ; inline : nth-byte ( x n -- b ) -8 * shift mask-byte ; inline @@ -14,12 +14,12 @@ IN: io.binary : >be ( x n -- byte-array ) >le reverse! ; : d>w/w ( d -- w1 w2 ) - [ HEX: ffffffff bitand ] - [ -32 shift HEX: ffffffff bitand ] bi ; + [ 0xffffffff bitand ] + [ -32 shift 0xffffffff bitand ] bi ; : w>h/h ( w -- h1 h2 ) - [ HEX: ffff bitand ] - [ -16 shift HEX: ffff bitand ] bi ; + [ 0xffff bitand ] + [ -16 shift 0xffff bitand ] bi ; : h>b/b ( h -- b1 b2 ) [ mask-byte ]