Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Feb 2023 11:56:26 GMT
From:      =?utf-8?Q?Jean-S=C3=A9bastien=20P=C3=A9dron?= <dumbbell@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 8fa54d4e40f0 - stable/13 - linuxkpi: Define `FIELD_FIT()`
Message-ID:  <202302161156.31GBuQ7E056151@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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))
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202302161156.31GBuQ7E056151>