git: 8fa54d4e40f0 - stable/13 - linuxkpi: Define `FIELD_FIT()`
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 16 Feb 2023 11:56:26 UTC
The branch stable/13 has been updated by dumbbell (ports committer):
URL: https://cgit.FreeBSD.org/src/commit/?id=8fa54d4e40f0cb3bb4b5c92ecc1a0c26a7289851
commit 8fa54d4e40f0cb3bb4b5c92ecc1a0c26a7289851
Author: Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
AuthorDate: 2023-02-08 23:38:22 +0000
Commit: Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
CommitDate: 2023-02-16 11:55:19 +0000
linuxkpi: Define `FIELD_FIT()`
Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D38536
(cherry picked from commit bf6f6650813959ecf3469854ad266c5a5590c754)
---
sys/compat/linuxkpi/common/include/linux/bitfield.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/sys/compat/linuxkpi/common/include/linux/bitfield.h b/sys/compat/linuxkpi/common/include/linux/bitfield.h
index c22757d54290..d21c7f9868dd 100644
--- a/sys/compat/linuxkpi/common/include/linux/bitfield.h
+++ b/sys/compat/linuxkpi/common/include/linux/bitfield.h
@@ -127,6 +127,9 @@ _uX_replace_bits(8)
#define __bf_shf(x) (__builtin_ffsll(x) - 1)
+#define FIELD_FIT(_mask, _value) \
+ (!(((typeof(_mask))(_value) << __bf_shf(_mask)) & ~(_mask)))
+
#define FIELD_PREP(_mask, _value) \
(((typeof(_mask))(_value) << __bf_shf(_mask)) & (_mask))