-************************************************************** * bitStream encoding ****************************************************************/ ! BIT_initCStream() : * `dstCapacity` must be > sizeof(size_t) * @return : 0 if success, * otherwise an error code (can be tested using ERR_isError()) */
| 1477 | * @return : 0 if success, |
| 1478 | * otherwise an error code (can be tested using ERR_isError()) */ |
| 1479 | MEM_STATIC size_t BIT_initCStream(BIT_CStream_t* bitC, |
| 1480 | void* startPtr, size_t dstCapacity) |
| 1481 | { |
| 1482 | bitC->bitContainer = 0; |
| 1483 | bitC->bitPos = 0; |
| 1484 | bitC->startPtr = (char*)startPtr; |
| 1485 | bitC->ptr = bitC->startPtr; |
| 1486 | bitC->endPtr = bitC->startPtr + dstCapacity - sizeof(bitC->bitContainer); |
| 1487 | if (dstCapacity <= sizeof(bitC->bitContainer)) return ERROR(dstSize_tooSmall); |
| 1488 | return 0; |
| 1489 | } |
| 1490 | |
| 1491 | /*! BIT_addBits() : |
| 1492 | * can add up to 31 bits into `bitC`. |
no outgoing calls
no test coverage detected