diff options
| author | Tony Lindgren <tony@atomide.com> | 2017-03-06 08:37:53 -0800 |
|---|---|---|
| committer | Tony Lindgren <tony@atomide.com> | 2017-03-06 08:37:53 -0800 |
| commit | e24bce8fb4c26bd0d8eca74cbbee1ad049246be3 (patch) | |
| tree | c219c2ec183633aa15841fca5b055a09d2d0b980 /include/linux/bitfield.h | |
| parent | b92675d998a9fa37fe9e0e35053a95b4a23c158b (diff) | |
| parent | c1ae3cfa0e89fa1a7ecc4c99031f5e9ae99d9201 (diff) | |
| download | lwn-e24bce8fb4c26bd0d8eca74cbbee1ad049246be3.tar.gz lwn-e24bce8fb4c26bd0d8eca74cbbee1ad049246be3.zip | |
Merge tag 'v4.11-rc1' into omap-for-v4.11/fixes
Linux 4.11-rc1
Diffstat (limited to 'include/linux/bitfield.h')
| -rw-r--r-- | include/linux/bitfield.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/bitfield.h b/include/linux/bitfield.h index f6505d83069d..8b9d6fff002d 100644 --- a/include/linux/bitfield.h +++ b/include/linux/bitfield.h @@ -63,6 +63,19 @@ }) /** + * FIELD_FIT() - check if value fits in the field + * @_mask: shifted mask defining the field's length and position + * @_val: value to test against the field + * + * Return: true if @_val can fit inside @_mask, false if @_val is too big. + */ +#define FIELD_FIT(_mask, _val) \ + ({ \ + __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_FIT: "); \ + !((((typeof(_mask))_val) << __bf_shf(_mask)) & ~(_mask)); \ + }) + +/** * FIELD_PREP() - prepare a bitfield element * @_mask: shifted mask defining the field's length and position * @_val: value to put in the field |
