Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F148611009
D6226.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
931 B
Referenced Files
None
Subscribers
None
D6226.diff
View Options
Index: head/sys/sys/_bitset.h
===================================================================
--- head/sys/sys/_bitset.h
+++ head/sys/sys/_bitset.h
@@ -47,4 +47,12 @@
long __bits[__bitset_words((_s))]; \
}
+/*
+ * Helper to declare a bitset without it's size being a constant.
+ *
+ * Sadly we cannot declare a bitset struct with '__bits[]', because it's
+ * the only member of the struct and the compiler complains.
+ */
+#define BITSET_DEFINE_VAR(t) BITSET_DEFINE(t, 1)
+
#endif /* !_SYS__BITSET_H_ */
Index: head/sys/sys/bitset.h
===================================================================
--- head/sys/sys/bitset.h
+++ head/sys/sys/bitset.h
@@ -199,4 +199,10 @@
#define BITSET_FSET(n) \
[ 0 ... ((n) - 1) ] = (-1L)
+/*
+ * Dynamically allocate a bitset.
+ */
+#define BITSET_ALLOC(_s, mt, mf) \
+ malloc(__bitset_words(_s) * sizeof(long), mt, (mf))
+
#endif /* !_SYS_BITSET_H_ */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Mar 20, 3:26 AM (7 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29969628
Default Alt Text
D6226.diff (931 B)
Attached To
Mode
D6226: bitset: introduce helpers to allocate a bitset at runtime
Attached
Detach File
Event Timeline
Log In to Comment