Differences From Artifact [694631f046]:
- File src/OFHuffmanTree.h — part of check-in [35de667566] at 2021-04-18 20:51:25 on branch new-naming-convention — Rename everything in several smaller files (user: js, size: 1651) [annotate] [blame] [check-ins using] [more...]
To Artifact [fd05cd38a9]:
- File
src/OFHuffmanTree.h
— part of check-in
[2fcf5a3052]
at
2021-04-29 23:24:22
on branch trunk
— Clean up struct and enum typedefs
With TYPEDEF_HIDES_STRUCT set, Doxygen properly handles anonymous
structs and enums that are typedef'd. (user: js, size: 1642) [annotate] [blame] [check-ins using] [more...]
| ︙ | ︙ | |||
18 19 20 21 22 23 24 | #import "macros.h" #import "OFInvalidFormatException.h" OF_ASSUME_NONNULL_BEGIN | | | | | | | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
#import "macros.h"
#import "OFInvalidFormatException.h"
OF_ASSUME_NONNULL_BEGIN
typedef struct _OFHuffmanTree {
struct _OFHuffmanTree *_Nullable leaves[2];
uint16_t value;
} *OFHuffmanTree;
/* Inlined for performance. */
static OF_INLINE bool
OFHuffmanTreeWalk(id _Nullable stream,
bool (*bitReader)(id _Nullable, uint16_t *_Nonnull, uint8_t),
OFHuffmanTree _Nonnull *_Nonnull tree, uint16_t *_Nonnull value)
{
OFHuffmanTree iter = *tree;
uint16_t bits;
while (iter->value == 0xFFFF) {
if OF_UNLIKELY (!bitReader(stream, &bits, 1)) {
*tree = iter;
return false;
}
|
| ︙ | ︙ | |||
51 52 53 54 55 56 57 |
*value = iter->value;
return true;
}
#ifdef __cplusplus
extern "C" {
#endif
| | | | | 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
*value = iter->value;
return true;
}
#ifdef __cplusplus
extern "C" {
#endif
extern OFHuffmanTree _Nonnull OFHuffmanTreeNew(uint8_t lengths[_Nonnull],
uint16_t count);
extern OFHuffmanTree _Nonnull OFHuffmanTreeNewSingle(uint16_t value);
extern void OFHuffmanTreeFree(OFHuffmanTree _Nonnull tree);
#ifdef __cplusplus
}
#endif
OF_ASSUME_NONNULL_END
|