authorgravatar for silver@silv.reSilver <silver@silv.re> 2021-12-24 05:38:14+00:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-05-10 21:30:58-04:00
loge0a514df41cdf40b0e99ba48b86143bfc03dd3aa
tree3b57c844a9ac342cf361c9f6b60611002070ba6d
parent67c4b16d6e27f1d81e2e2f837bd53d958b9baa33

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

1 files changed, 2 insertions(+), 2 deletions(-)

lib/std/bit_set.zig+2-2
...@@ -50,7 +50,7 @@ pub fn StaticBitSet(comptime size: usize) type {...@@ -50,7 +50,7 @@ pub fn StaticBitSet(comptime size: usize) type {
50/// This set is good for sets with a small size, but may generate50/// This set is good for sets with a small size, but may generate
51/// inefficient code for larger sets, especially in debug mode.51/// inefficient code for larger sets, especially in debug mode.
52pub fn IntegerBitSet(comptime size: u16) type {52pub fn IntegerBitSet(comptime size: u16) type {
53 return struct {53 return packed struct {
54 const Self = @This();54 const Self = @This();
5555
56 // TODO: Make this a comptime field once those are fixed56 // TODO: Make this a comptime field once those are fixed
...@@ -287,7 +287,7 @@ pub fn ArrayBitSet(comptime MaskIntType: type, comptime size: usize) type {...@@ -287,7 +287,7 @@ pub fn ArrayBitSet(comptime MaskIntType: type, comptime size: usize) type {
287 ", which contains padding bits. Please round this up to an unpadded integer size (i.e. " ++ @typeName(FixedMaskType) ++ ").");287 ", which contains padding bits. Please round this up to an unpadded integer size (i.e. " ++ @typeName(FixedMaskType) ++ ").");
288 }288 }
289289
290 return struct {290 return extern struct {
291 const Self = @This();291 const Self = @This();
292292
293 // TODO: Make this a comptime field once those are fixed293 // TODO: Make this a comptime field once those are fixed