commit e0a514df41cdf40b0e99ba48b86143bfc03dd3aa (tree)
parent 67c4b16d6e27f1d81e2e2f837bd53d958b9baa33
Author: Silver <silver@silv.re>
Date: Fri, 24 Dec 2021 05:38:14 +0000
std: make IntegerBitSet and ArrayBitSet have defined memory layout
This is useful for wrapping C libraries and native interfaces that make use of bit sets
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/std/bit_set.zig b/lib/std/bit_set.zig
@@ -50,7 +50,7 @@ pub fn StaticBitSet(comptime size: usize) type {
/// This set is good for sets with a small size, but may generate
/// inefficient code for larger sets, especially in debug mode.
pub fn IntegerBitSet(comptime size: u16) type {
- return struct {
+ return packed struct {
const Self = @This();
// TODO: Make this a comptime field once those are fixed
@@ -287,7 +287,7 @@ pub fn ArrayBitSet(comptime MaskIntType: type, comptime size: usize) type {
", which contains padding bits. Please round this up to an unpadded integer size (i.e. " ++ @typeName(FixedMaskType) ++ ").");
}
- return struct {
+ return extern struct {
const Self = @This();
// TODO: Make this a comptime field once those are fixed