mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice-common
synced 2026-01-11 08:07:23 +00:00
Use code to compute a bit mask
Code is in the slow path, this reduce space needed for data+code. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
This commit is contained in:
parent
580adf7c36
commit
75cb2701d3
@ -194,16 +194,7 @@ static const unsigned long int bppmask[33] = {
|
||||
0x1fffffff, 0x3fffffff, 0x7fffffff, 0xffffffff /* [32] */
|
||||
};
|
||||
|
||||
static const unsigned int bitat[32] = {
|
||||
0x00000001, 0x00000002, 0x00000004, 0x00000008,
|
||||
0x00000010, 0x00000020, 0x00000040, 0x00000080,
|
||||
0x00000100, 0x00000200, 0x00000400, 0x00000800,
|
||||
0x00001000, 0x00002000, 0x00004000, 0x00008000,
|
||||
0x00010000, 0x00020000, 0x00040000, 0x00080000,
|
||||
0x00100000, 0x00200000, 0x00400000, 0x00800000,
|
||||
0x01000000, 0x02000000, 0x04000000, 0x08000000,
|
||||
0x10000000, 0x20000000, 0x40000000, 0x80000000 /* [31]*/
|
||||
};
|
||||
#define bitat(n) (1u<<(n))
|
||||
|
||||
|
||||
#define TABRAND_TABSIZE 256
|
||||
@ -371,7 +362,7 @@ static void golomb_coding_slow(QuicFamily *family, const BYTE n, const unsigned
|
||||
unsigned int * const codewordlen)
|
||||
{
|
||||
if (n < family->nGRcodewords[l]) {
|
||||
(*codeword) = bitat[l] | (n & bppmask[l]);
|
||||
(*codeword) = bitat(l) | (n & bppmask[l]);
|
||||
(*codewordlen) = (n >> l) + l + 1;
|
||||
} else {
|
||||
(*codeword) = n - family->nGRcodewords[l];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user