diff options
| author | 2017-05-02 09:48:26 -0700 | |
|---|---|---|
| committer | 2017-05-02 09:48:26 -0700 | |
| commit | 0337966d121ebebf73a1c346123e8112796e684e (patch) | |
| tree | c0d4388591e72dc5a26ee976a9cbca70f6bafbbd /include/linux/bitfield.h | |
| parent | Input: i8042 - add Clevo P650RS to the i8042 reset list (diff) | |
| parent | Input: ar1021_i2c - use BIT to check for a bit (diff) | |
| download | linux-dev-0337966d121ebebf73a1c346123e8112796e684e.tar.xz linux-dev-0337966d121ebebf73a1c346123e8112796e684e.zip | |
Merge branch 'next' into for-linus
Prepare input updates for 4.12 merge window.
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 |
