 : decode-quad ( byte-array -- char )
     dup mapping value-at [ ] [
         linear dup gb>u interval-at [
-            [ bfirst>> linear - ] [ ufirst>> ] bi +
+            [ bfirst>> - ] [ ufirst>> ] bi +
         ] [ drop replacement-char ] if*
     ] ?if ;
 

        {
            [ "uFirst" attr hex> ]
            [ "uLast" attr hex> ]
            [ "bFirst" attr b>byte-array ]
            [ "bLast" attr b>byte-array ]
        } cleave range boa
    ] dip push ;


! Resource file from:
! http://source.icu-project.org/repos/icu/data/trunk/charset/data/xml/gb-18030-2000.xml

! Algorithms from:
! http://www-128.ibm.com/developerworks/library/u-china.html

: linear ( bytes -- num )
    ! This hard-codes bMin and bMax
    reverse first4
    10 * + 126 * + 10 * + ; foldable

TUPLE: range ufirst ulast bfirst blast ;

: b>byte-array ( string -- byte-array )
