| ... | @@ -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 | } |
| 146 | | 146 | |
| 147 | /// Deprecated, use `@bitSizeOf()`. | | |
| 148 | /// TODO Remove this after zig 0.10.0 is released. | | |
| 149 | pub 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 | | | |
| 158 | test "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 than | 148 | /// 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). |