• Home
  • Raw
  • Download

Lines Matching refs:p

74 static int next_bits(struct sw842_param *p, u64 *d, u8 n);
76 static int __split_next_bits(struct sw842_param *p, u64 *d, u8 n, u8 s) in __split_next_bits() argument
86 ret = next_bits(p, &tmp, n - s); in __split_next_bits()
89 ret = next_bits(p, d, s); in __split_next_bits()
96 static int next_bits(struct sw842_param *p, u64 *d, u8 n) in next_bits() argument
98 u8 *in = p->in, b = p->bit, bits = b + n; in next_bits()
109 return __split_next_bits(p, d, n, 32); in next_bits()
110 else if (p->ilen < 8 && bits > 32 && bits <= 56) in next_bits()
111 return __split_next_bits(p, d, n, 16); in next_bits()
112 else if (p->ilen < 4 && bits > 16 && bits <= 24) in next_bits()
113 return __split_next_bits(p, d, n, 8); in next_bits()
115 if (DIV_ROUND_UP(bits, 8) > p->ilen) in next_bits()
129 p->bit += n; in next_bits()
131 if (p->bit > 7) { in next_bits()
132 p->in += p->bit / 8; in next_bits()
133 p->ilen -= p->bit / 8; in next_bits()
134 p->bit %= 8; in next_bits()
140 static int do_data(struct sw842_param *p, u8 n) in do_data() argument
145 if (n > p->olen) in do_data()
148 ret = next_bits(p, &v, n * 8); in do_data()
154 put_unaligned(cpu_to_be16((u16)v), (__be16 *)p->out); in do_data()
157 put_unaligned(cpu_to_be32((u32)v), (__be32 *)p->out); in do_data()
160 put_unaligned(cpu_to_be64((u64)v), (__be64 *)p->out); in do_data()
166 p->out += n; in do_data()
167 p->olen -= n; in do_data()
172 static int __do_index(struct sw842_param *p, u8 size, u8 bits, u64 fsize) in __do_index() argument
174 u64 index, offset, total = round_down(p->out - p->ostart, 8); in __do_index()
177 ret = next_bits(p, &index, bits); in __do_index()
208 (unsigned long)beN_to_cpu(&p->ostart[offset], size)); in __do_index()
210 memcpy(p->out, &p->ostart[offset], size); in __do_index()
211 p->out += size; in __do_index()
212 p->olen -= size; in __do_index()
217 static int do_index(struct sw842_param *p, u8 n) in do_index() argument
221 return __do_index(p, 2, I2_BITS, I2_FIFO_SIZE); in do_index()
223 return __do_index(p, 4, I4_BITS, I4_FIFO_SIZE); in do_index()
225 return __do_index(p, 8, I8_BITS, I8_FIFO_SIZE); in do_index()
231 static int do_op(struct sw842_param *p, u8 o) in do_op() argument
245 ret = do_data(p, op & OP_AMOUNT); in do_op()
248 ret = do_index(p, op & OP_AMOUNT); in do_op()
285 struct sw842_param p; in sw842_decompress() local
290 p.in = (u8 *)in; in sw842_decompress()
291 p.bit = 0; in sw842_decompress()
292 p.ilen = ilen; in sw842_decompress()
293 p.out = out; in sw842_decompress()
294 p.ostart = out; in sw842_decompress()
295 p.olen = *olen; in sw842_decompress()
297 total = p.olen; in sw842_decompress()
302 ret = next_bits(&p, &op, OP_BITS); in sw842_decompress()
310 ret = next_bits(&p, &rep, REPEAT_BITS); in sw842_decompress()
314 if (p.out == out) /* no previous bytes */ in sw842_decompress()
320 if (rep * 8 > p.olen) in sw842_decompress()
324 memcpy(p.out, p.out - 8, 8); in sw842_decompress()
325 p.out += 8; in sw842_decompress()
326 p.olen -= 8; in sw842_decompress()
334 if (8 > p.olen) in sw842_decompress()
337 memset(p.out, 0, 8); in sw842_decompress()
338 p.out += 8; in sw842_decompress()
339 p.olen -= 8; in sw842_decompress()
346 ret = next_bits(&p, &bytes, SHORT_DATA_BITS); in sw842_decompress()
354 ret = next_bits(&p, &tmp, 8); in sw842_decompress()
357 *p.out = (u8)tmp; in sw842_decompress()
358 p.out++; in sw842_decompress()
359 p.olen--; in sw842_decompress()
372 ret = do_op(&p, op); in sw842_decompress()
383 ret = next_bits(&p, &crc, CRC_BITS); in sw842_decompress()
390 if (crc != (u64)crc32_be(0, out, total - p.olen)) { in sw842_decompress()
395 if (unlikely((total - p.olen) > UINT_MAX)) in sw842_decompress()
398 *olen = total - p.olen; in sw842_decompress()