Skip to content

Getting maximum data length #30

@spequer

Description

@spequer

I'm using following code to get maximum possible data length with bch setting:

  • bch.c
        /* sanity check: make sure data length can be handled */
        if (8*len > (bch->n-bch->ecc_bits)) {
                printf("Error: Invalid length: %d %d (%d)\n", len, (bch->n-bch->ecc_bits) / 8, bch->n-bch->ecc_bits);
                return -EINVAL;
        }

Using following code to extract the result:

    data = bytearray(data[:1000])
    ic(len(data), bch.ecc_bytes , bch.ecc_bits, bch.m, bch.n, bch.t )
    ecc = bch.encode(data)

The value 919 (polynominal 8219, bits 64) is not shown in read-only settings:
ic| len(data): 1000
bch.ecc_bytes: 104
bch.ecc_bits: 832
bch.m: 13
bch.n: 8191
bch.t: 64
ic| len(data): 1000, len(ecc): 104
Error: Invalid length: 1000 919 (7359)

It seems it is the value (8191-832) / 8 = 919..

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions