• Kirill Smelkov's avatar
    encoder: Fix int ranges for which BININT1 and BININT2 are emitted · 6ce3a6ee
    Kirill Smelkov authored
    BININT1 emits unsigned integer that fits into 1 byte.
    BININT2 emits unsigned integer that fits into 2 bytes.
    
    So they cover [0, 0xff] and [0, 0xffff] ranges including edges. However
    we were emitting BININTX opcodes only for numbers being strictly inside
    those ranges - i.e. (0, 0xff) and (0, 0xffff) - without edges. As the
    result what could be emitted as "K\x00." was emitted as
    "J\x00\x00\x00\x00." and so on.
    
    Fix it by emitting BININT1 for [0, 0xff] inclusive and BININT for [0,
    0xffff] also inclusive.
    6ce3a6ee
ogorek_test.go 38.8 KB