Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:lib\842\842_compress.c Create Date:2022-07-28 06:57:16
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:add_bits

Proto:static int add_bits(struct sw842_param *p, u64 d, u8 n)

Type:int

Parameter:

TypeParameterName
struct sw842_param *p
u64d
u8n
169  b = bit , bits = b + n , s = und_up - round up to next specified power of 2*@x: the value to round*@y: multiple to round up to (must be a power of 2)* Rounds @x up to next multiple of @y (which must be a power of 2).* To perform arbitrary rounding up, use roundup() below.(bits, 8) - bits
171  out = out
173  pr_debug("add %u bits %lx\n", (unsignedchar)n, (unsignedlong)d)
175  If n > 64 Then Return -EINVAL
181  If bits > 64 Then Return __split_add_bits(p, d, n, 32)
183  Else if olen < 8 && bits > 32 && bits <= 56 Then Return __split_add_bits(p, d, n, 16)
185  Else if olen < 4 && bits > 16 && bits <= 24 Then Return __split_add_bits(p, d, n, 8)
188  If DIV_ROUND_UP(bits, 8) > olen Then Return -ENOSPC
191  o = out & bmask[b]
192  d <<= s
194  If bits <= 8 Then out = o | d
196  Else if bits <= 16 Then put value to a possibly mis-aligned location(cpu_to_be16(o << 8 | d), (__be16 * )out)
198  Else if bits <= 24 Then put value to a possibly mis-aligned location(cpu_to_be32(o << 24 | d << 8), (__be32 * )out)
200  Else if bits <= 32 Then put value to a possibly mis-aligned location(cpu_to_be32(o << 24 | d), (__be32 * )out)
202  Else if bits <= 40 Then put value to a possibly mis-aligned location(cpu_to_be64(o << 56 | d << 24), (__be64 * )out)
204  Else if bits <= 48 Then put value to a possibly mis-aligned location(cpu_to_be64(o << 56 | d << 16), (__be64 * )out)
206  Else if bits <= 56 Then put value to a possibly mis-aligned location(cpu_to_be64(o << 56 | d << 8), (__be64 * )out)
208  Else put value to a possibly mis-aligned location(cpu_to_be64(o << 56 | d), (__be64 * )out)
211  bit += n
213  If bit > 7 Then
214  out += bit / 8
215  olen -= bit / 8
216  bit %= 8
219  Return 0
Caller
NameDescribe
__split_add_bits
add_template
add_repeat_template
add_short_data_template
add_zeros_template
add_end_template
sw842_compresssw842_compress* Compress the uncompressed buffer of length @ilen at @in to the output buffer*@out, using no more than @olen bytes, using the 842 compression format