Decode an encoded number between 1 and 15 inclusive. * When successful returns the decoded result. * If the decoded value would be too large, 'SIMPLICITY_ERR_DATA_OUT_OF_RANGE' is returned. * If more bits are needed than available in the 'stream', 'SIMPLICITY_ERR_BITSTRING_EOF' is returned. * If an I/O error occurs when reading from the 'stream', 'SIMPLICITY_ERR_BISTRING_ERROR' is returned. *
| 125 | * Precondition: NULL != stream |
| 126 | */ |
| 127 | static int32_t decodeUpto15(bitstream* stream) { |
| 128 | int32_t result; |
| 129 | int32_t len = decodeUpto3Bits(&result, stream); |
| 130 | if (len < 0) return len; |
| 131 | result |= 1 << len; |
| 132 | return result; |
| 133 | } |
| 134 | |
| 135 | /* Decode an encoded bitstring up to length 15. |
| 136 | * If successful returns the length of the bitstring and 'result' contains the decoded bits. |
no test coverage detected