1 // SPDX-License-Identifier: Zlib
5 #include <linux/zutil.h>
8 * C wrapper for the DEFLATE CONVERSION CALL instruction.
12 DFLTCC_CC_OP1_TOO_SHORT = 1,
13 DFLTCC_CC_OP2_TOO_SHORT = 2,
14 DFLTCC_CC_OP2_CORRUPT = 2,
22 #define HBT_CIRCULAR (1 << 7)
24 #define HB_SIZE (1 << HB_BITS)
26 static inline dfltcc_cc dfltcc(
36 Byte *t2 = op1 ? *op1 : NULL;
37 size_t t3 = len1 ? *len1 : 0;
38 const Byte *t4 = op2 ? *op2 : NULL;
39 size_t t5 = len2 ? *len2 : 0;
40 register int r0 __asm__("r0") = fn;
41 register void *r1 __asm__("r1") = param;
42 register Byte *r2 __asm__("r2") = t2;
43 register size_t r3 __asm__("r3") = t3;
44 register const Byte *r4 __asm__("r4") = t4;
45 register size_t r5 __asm__("r5") = t5;
49 ".insn rrf,0xb9390000,%[r2],%[r4],%[hist],0\n"
60 t2 = r2; t3 = r3; t4 = r4; t5 = r5;
70 return (cc >> 28) & 3;
73 static inline int is_bit_set(
78 return bits[n / 8] & (1 << (7 - (n % 8)));
81 static inline void turn_bit_off(
86 bits[n / 8] &= ~(1 << (7 - (n % 8)));
89 static inline int dfltcc_are_params_ok(
96 return (level_mask & (1 << level)) != 0 &&
97 (window_bits == HB_BITS) &&
98 (strategy == Z_DEFAULT_STRATEGY);
101 char *oesc_msg(char *buf, int oesc);
103 #endif /* DFLTCC_UTIL_H */