authorgravatar for r00ster91@proton.meWooster <r00ster91@proton.me> 2022-12-16 17:12:59+01:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2022-12-17 00:15:47+02:00
log8da9cc85af8d8f587b12e2d1ee275f50bf83b224
tree77ac1e60cc6649f9c4417c4ad1b2006d4ae26996
parent8c8f6bfa642bf69a997bb64dc9bc7c89f7b86c3c

std.meta: remove bitCount


1 files changed, 0 insertions(+), 16 deletions(-)

lib/std/meta.zig-16
...@@ -144,22 +144,6 @@ test "std.meta.stringToEnum" {...@@ -144,22 +144,6 @@ test "std.meta.stringToEnum" {
144 try testing.expect(null == stringToEnum(E1, "C"));144 try testing.expect(null == stringToEnum(E1, "C"));
145}145}
146146
147/// Deprecated, use `@bitSizeOf()`.
148/// TODO Remove this after zig 0.10.0 is released.
149pub fn bitCount(comptime T: type) comptime_int {
150 return switch (@typeInfo(T)) {
151 .Bool => 1,
152 .Int => |info| info.bits,
153 .Float => |info| info.bits,
154 else => @compileError("Expected bool, int or float type, found '" ++ @typeName(T) ++ "'"),
155 };
156}
157
158test "std.meta.bitCount" {
159 try testing.expect(bitCount(u8) == 8);
160 try testing.expect(bitCount(f32) == 32);
161}
162
163/// Returns the alignment of type T.147/// Returns the alignment of type T.
164/// Note that if T is a pointer or function type the result is different than148/// Note that if T is a pointer or function type the result is different than
165/// the one returned by @alignOf(T).149/// the one returned by @alignOf(T).