buildDtable will build the decoding table.
()
| 37 | |
| 38 | // buildDtable will build the decoding table. |
| 39 | func (s *fseDecoder) buildDtable() error { |
| 40 | ctx := buildDtableAsmContext{ |
| 41 | stateTable: &s.stateTable[0], |
| 42 | norm: &s.norm[0], |
| 43 | dt: (*uint64)(&s.dt[0]), |
| 44 | } |
| 45 | code := buildDtable_asm(s, &ctx) |
| 46 | |
| 47 | if code != 0 { |
| 48 | switch code { |
| 49 | case errorCorruptedNormalizedCounter: |
| 50 | position := ctx.errParam1 |
| 51 | return fmt.Errorf("corrupted input (position=%d, expected 0)", position) |
| 52 | |
| 53 | case errorNewStateTooBig: |
| 54 | newState := decSymbol(ctx.errParam1) |
| 55 | size := ctx.errParam2 |
| 56 | return fmt.Errorf("newState (%d) outside table size (%d)", newState, size) |
| 57 | |
| 58 | case errorNewStateNoBits: |
| 59 | newState := decSymbol(ctx.errParam1) |
| 60 | oldState := decSymbol(ctx.errParam2) |
| 61 | return fmt.Errorf("newState (%d) == oldState (%d) and no bits", newState, oldState) |
| 62 | |
| 63 | default: |
| 64 | return fmt.Errorf("buildDtable_asm returned unhandled nonzero code = %d", code) |
| 65 | } |
| 66 | } |
| 67 | return nil |
| 68 | } |