hc
2024-05-10 37f49e37ab4cb5d0bc4c60eb5c6d4dd57db767bb
kernel/include/linux/tnum.h
....@@ -5,6 +5,10 @@
55 * propagate the unknown bits such that the tnum result represents all the
66 * possible results for possible values of the operands.
77 */
8
+
9
+#ifndef _LINUX_TNUM_H
10
+#define _LINUX_TNUM_H
11
+
812 #include <linux/types.h>
913
1014 struct tnum {
....@@ -81,3 +85,17 @@
8185 int tnum_strn(char *str, size_t size, struct tnum a);
8286 /* Format a tnum as tristate binary expansion */
8387 int tnum_sbin(char *str, size_t size, struct tnum a);
88
+
89
+/* Returns the 32-bit subreg */
90
+struct tnum tnum_subreg(struct tnum a);
91
+/* Returns the tnum with the lower 32-bit subreg cleared */
92
+struct tnum tnum_clear_subreg(struct tnum a);
93
+/* Returns the tnum with the lower 32-bit subreg set to value */
94
+struct tnum tnum_const_subreg(struct tnum a, u32 value);
95
+/* Returns true if 32-bit subreg @a is a known constant*/
96
+static inline bool tnum_subreg_is_const(struct tnum a)
97
+{
98
+ return !(tnum_subreg(a)).mask;
99
+}
100
+
101
+#endif /* _LINUX_TNUM_H */