* If the output buffer space is exhausted, then the bits will be ignored, and
* xpress_flush_output() will return 0 when it gets called.
*/
-static inline void
+static forceinline void
xpress_write_bits(struct xpress_output_bitstream *os,
const u32 bits, const unsigned num_bits)
{
/*
* Interweave a literal byte into the output bitstream.
*/
-static inline void
+static forceinline void
xpress_write_byte(struct xpress_output_bitstream *os, u8 byte)
{
if (os->next_byte < os->end)
/*
* Interweave two literal bytes into the output bitstream.
*/
-static inline void
+static forceinline void
xpress_write_u16(struct xpress_output_bitstream *os, u16 v)
{
if (os->end - os->next_byte >= 2) {
return os->next_byte - os->start;
}
-static inline void
+static forceinline void
xpress_write_extra_length_bytes(struct xpress_output_bitstream *os,
unsigned adjusted_len)
{
}
/* Output a match or literal. */
-static inline void
+static forceinline void
xpress_write_item(struct xpress_item item, struct xpress_output_bitstream *os,
const u32 codewords[], const u8 lens[])
{
unsigned sym;
adjusted_len = length - XPRESS_MIN_MATCH_LEN;
- log2_offset = fls32(offset);
+ log2_offset = bsr32(offset);
len_hdr = min(0xF, adjusted_len);
sym = XPRESS_NUM_CHARS + ((log2_offset << 4) | len_hdr);
/* Tally the Huffman symbol for a literal and return the intermediate
* representation of that literal. */
-static inline struct xpress_item
+static forceinline struct xpress_item
xpress_record_literal(struct xpress_compressor *c, unsigned literal)
{
c->freqs[literal]++;
/* Tally the Huffman symbol for a match and return the intermediate
* representation of that match. */
-static inline struct xpress_item
+static forceinline struct xpress_item
xpress_record_match(struct xpress_compressor *c, unsigned length, unsigned offset)
{
unsigned adjusted_len = length - XPRESS_MIN_MATCH_LEN;
unsigned len_hdr = min(adjusted_len, 0xF);
- unsigned log2_offset = fls32(offset);
+ unsigned log2_offset = bsr32(offset);
unsigned sym = XPRESS_NUM_CHARS + ((log2_offset << 4) | len_hdr);
c->freqs[sym]++;
unsigned sym;
adjusted_len = length - XPRESS_MIN_MATCH_LEN;
- log2_offset = fls32(offset);
+ log2_offset = bsr32(offset);
len_hdr = min(0xF, adjusted_len);
sym = XPRESS_NUM_CHARS + ((log2_offset << 4) | len_hdr);
u32 offset_cost;
offset = match->offset;
- log2_offset = fls32(offset);
+ log2_offset = bsr32(offset);
offset_cost = log2_offset;
do {
unsigned len_hdr;
u32 offset_cost;
offset = match->offset;
- log2_offset = fls32(offset);
+ log2_offset = bsr32(offset);
offset_cost = log2_offset;
do {
unsigned adjusted_len;