Decode an encoded number between 1 and 65535 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.
| 169 | * Precondition: NULL != stream |
| 170 | */ |
| 171 | static int32_t decodeUpto65535(bitstream* stream) { |
| 172 | int32_t result; |
| 173 | int32_t len = decodeUpto15Bits(&result, stream); |
| 174 | if (len < 0) return len; |
| 175 | result |= 1 << len; |
| 176 | return result; |
| 177 | } |
| 178 | |
| 179 | /* Decode an encoded number between 1 and 2^31 - 1 inclusive. |
| 180 | * When successful returns the decoded result. |
no test coverage detected