Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F148640498
D6226.id15964.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
994 B
Referenced Files
None
Subscribers
None
D6226.id15964.diff
View Options
Index: sys/sys/_bitset.h
===================================================================
--- sys/sys/_bitset.h
+++ sys/sys/_bitset.h
@@ -58,4 +58,12 @@
#define BITSET_FSET(n) \
[ 0 ... ((n) - 1) ] = (-1L)
+/*
+ * 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: sys/sys/bitset.h
===================================================================
--- sys/sys/bitset.h
+++ sys/sys/bitset.h
@@ -185,5 +185,13 @@
__count += __bitcountl((p)->__bits[__i]); \
__count; \
})
-
+
+/*
+ * Dynamically allocate a bitset.
+ *
+ * NB: p must be cleaned by the caller by freeing it after use.
+ */
+#define BITSET_ALLOC(p, _s, mt, mf) \
+ p = malloc(__bitset_words(_s) * sizeof(long), mt, mf)
+
#endif /* !_SYS_BITSET_H_ */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Mar 20, 7:37 AM (18 h, 53 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
30007670
Default Alt Text
D6226.id15964.diff (994 B)
Attached To
Mode
D6226: bitset: introduce helpers to allocate a bitset at runtime
Attached
Detach File
Event Timeline
Log In to Comment