Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Feb 2023 21:09:49 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-main@FreeBSD.org
Subject:   git: bf6f66508139 - main - linuxkpi: Define `FIELD_FIT()`
Message-ID:  <202302132109.31DL9nqG056416@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by dumbbell (ports committer):

URL: https://cgit.FreeBSD.org/src/commit/?id=bf6f6650813959ecf3469854ad266c5a5590c754

commit bf6f6650813959ecf3469854ad266c5a5590c754
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-13 21:09:31 +0000

    linuxkpi: Define `FIELD_FIT()`
    
    Reviewed by:    manu
    Approved by:    manu
    Differential Revision:  https://reviews.freebsd.org/D38536
---
 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?202302132109.31DL9nqG056416>