Lines Matching refs:a
37 struct tnum tnum_lshift(struct tnum a, u8 shift) in tnum_lshift() argument
39 return TNUM(a.value << shift, a.mask << shift); in tnum_lshift()
42 struct tnum tnum_rshift(struct tnum a, u8 shift) in tnum_rshift() argument
44 return TNUM(a.value >> shift, a.mask >> shift); in tnum_rshift()
47 struct tnum tnum_arshift(struct tnum a, u8 min_shift, u8 insn_bitness) in tnum_arshift() argument
55 return TNUM((u32)(((s32)a.value) >> min_shift), in tnum_arshift()
56 (u32)(((s32)a.mask) >> min_shift)); in tnum_arshift()
58 return TNUM((s64)a.value >> min_shift, in tnum_arshift()
59 (s64)a.mask >> min_shift); in tnum_arshift()
62 struct tnum tnum_add(struct tnum a, struct tnum b) in tnum_add() argument
66 sm = a.mask + b.mask; in tnum_add()
67 sv = a.value + b.value; in tnum_add()
70 mu = chi | a.mask | b.mask; in tnum_add()
74 struct tnum tnum_sub(struct tnum a, struct tnum b) in tnum_sub() argument
78 dv = a.value - b.value; in tnum_sub()
79 alpha = dv + a.mask; in tnum_sub()
82 mu = chi | a.mask | b.mask; in tnum_sub()
86 struct tnum tnum_and(struct tnum a, struct tnum b) in tnum_and() argument
90 alpha = a.value | a.mask; in tnum_and()
92 v = a.value & b.value; in tnum_and()
96 struct tnum tnum_or(struct tnum a, struct tnum b) in tnum_or() argument
100 v = a.value | b.value; in tnum_or()
101 mu = a.mask | b.mask; in tnum_or()
105 struct tnum tnum_xor(struct tnum a, struct tnum b) in tnum_xor() argument
109 v = a.value ^ b.value; in tnum_xor()
110 mu = a.mask | b.mask; in tnum_xor()
122 struct tnum tnum_mul(struct tnum a, struct tnum b) in tnum_mul() argument
124 u64 acc_v = a.value * b.value; in tnum_mul()
127 while (a.value || a.mask) { in tnum_mul()
129 if (a.value & 1) in tnum_mul()
132 else if (a.mask & 1) in tnum_mul()
135 a = tnum_rshift(a, 1); in tnum_mul()
144 struct tnum tnum_intersect(struct tnum a, struct tnum b) in tnum_intersect() argument
148 v = a.value | b.value; in tnum_intersect()
149 mu = a.mask & b.mask; in tnum_intersect()
153 struct tnum tnum_cast(struct tnum a, u8 size) in tnum_cast() argument
155 a.value &= (1ULL << (size * 8)) - 1; in tnum_cast()
156 a.mask &= (1ULL << (size * 8)) - 1; in tnum_cast()
157 return a; in tnum_cast()
160 bool tnum_is_aligned(struct tnum a, u64 size) in tnum_is_aligned() argument
164 return !((a.value | a.mask) & (size - 1)); in tnum_is_aligned()
167 bool tnum_in(struct tnum a, struct tnum b) in tnum_in() argument
169 if (b.mask & ~a.mask) in tnum_in()
171 b.value &= ~a.mask; in tnum_in()
172 return a.value == b.value; in tnum_in()
175 int tnum_strn(char *str, size_t size, struct tnum a) in tnum_strn() argument
177 return snprintf(str, size, "(%#llx; %#llx)", a.value, a.mask); in tnum_strn()
181 int tnum_sbin(char *str, size_t size, struct tnum a) in tnum_sbin() argument
187 if (a.mask & 1) in tnum_sbin()
189 else if (a.value & 1) in tnum_sbin()
194 a.mask >>= 1; in tnum_sbin()
195 a.value >>= 1; in tnum_sbin()
201 struct tnum tnum_subreg(struct tnum a) in tnum_subreg() argument
203 return tnum_cast(a, 4); in tnum_subreg()
206 struct tnum tnum_clear_subreg(struct tnum a) in tnum_clear_subreg() argument
208 return tnum_lshift(tnum_rshift(a, 32), 32); in tnum_clear_subreg()
211 struct tnum tnum_const_subreg(struct tnum a, u32 value) in tnum_const_subreg() argument
213 return tnum_or(tnum_clear_subreg(a), tnum_const(value)); in tnum_const_subreg()