]> git.proxmox.com Git - ceph.git/blame - ceph/src/isa-l/igzip/encode_df.c
update sources to v12.1.1
[ceph.git] / ceph / src / isa-l / igzip / encode_df.c
CommitLineData
224ce89b
WB
1#include <stdio.h>
2#include <stdlib.h>
3#include <stdint.h>
4#include <memory.h>
5#include <assert.h>
6
7#ifdef _MSC_VER
8# include <intrin.h>
9#else
10# include <x86intrin.h>
11#endif
12
13#include "encode_df.h"
14#include "bitbuf2.h"
15
16struct deflate_icf *encode_deflate_icf_base(struct deflate_icf *next_in,
17 struct deflate_icf *end_in, struct BitBuf2 *bb,
18 struct hufftables_icf *hufftables)
19{
20 struct huff_code lsym, dsym;
21
22 while (next_in < end_in && !is_full(bb)) {
23 lsym = hufftables->lit_len_table[next_in->lit_len];
24 dsym = hufftables->dist_table[next_in->lit_dist];
25
26 // insert ll code, dist_code, and extra_bits
27 write_bits_unsafe(bb, lsym.code_and_extra, lsym.length);
28 write_bits_unsafe(bb, dsym.code, dsym.length);
29 write_bits_unsafe(bb, next_in->dist_extra, dsym.extra_bit_count);
30 flush_bits(bb);
31
32 next_in++;
33 }
34
35 return next_in;
36}