.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* tnum: tracked (or tristate) numbers |
---|
2 | 3 | * |
---|
3 | 4 | * A tnum tracks knowledge about the bits of a value. Each bit can be either |
---|
.. | .. |
---|
193 | 194 | str[min(size - 1, (size_t)64)] = 0; |
---|
194 | 195 | return 64; |
---|
195 | 196 | } |
---|
| 197 | + |
---|
| 198 | +struct tnum tnum_subreg(struct tnum a) |
---|
| 199 | +{ |
---|
| 200 | + return tnum_cast(a, 4); |
---|
| 201 | +} |
---|
| 202 | + |
---|
| 203 | +struct tnum tnum_clear_subreg(struct tnum a) |
---|
| 204 | +{ |
---|
| 205 | + return tnum_lshift(tnum_rshift(a, 32), 32); |
---|
| 206 | +} |
---|
| 207 | + |
---|
| 208 | +struct tnum tnum_const_subreg(struct tnum a, u32 value) |
---|
| 209 | +{ |
---|
| 210 | + return tnum_or(tnum_clear_subreg(a), tnum_const(value)); |
---|
| 211 | +} |
---|