| author | |
| committer | |
| log | 407916cd2f3f4931de29fd87b8c9ae3faeba8452 |
| tree | 5ee194f80ce127d81e220869cd56bb53c1c04f17 |
| parent | def4fbc9ab704b1add5c3af40692b3d26594e58e |
closes #32712 files changed, 29 insertions(+), 29 deletions(-)
doc/langref.md+1-1| ... | ... | @@ -584,7 +584,7 @@ to stderr, and then a newline at the end. |
| 584 | 584 | This function can be used to do "printf debugging" on compile-time executing |
| 585 | 585 | code. |
| 586 | 586 | |
| 587 | ### @intType(comptime is_signed: bool, comptime bit_count: u8) -> type | |
| 587 | ### @IntType(comptime is_signed: bool, comptime bit_count: u8) -> type | |
| 588 | 588 | |
| 589 | 589 | This function returns an integer type with the given signness and bit count. |
| 590 | 590 |
src/codegen.cpp+1-1| ... | ... | @@ -4500,7 +4500,7 @@ static void define_builtin_fns(CodeGen *g) { |
| 4500 | 4500 | create_builtin_fn(g, BuiltinFnIdTruncate, "truncate", 2); |
| 4501 | 4501 | create_builtin_fn(g, BuiltinFnIdCompileErr, "compileError", 1); |
| 4502 | 4502 | create_builtin_fn(g, BuiltinFnIdCompileLog, "compileLog", SIZE_MAX); |
| 4503 | create_builtin_fn(g, BuiltinFnIdIntType, "intType", 2); | |
| 4503 | create_builtin_fn(g, BuiltinFnIdIntType, "IntType", 2); | |
| 4504 | 4504 | create_builtin_fn(g, BuiltinFnIdSetDebugSafety, "setDebugSafety", 2); |
| 4505 | 4505 | create_builtin_fn(g, BuiltinFnIdSetGlobalAlign, "setGlobalAlign", 2); |
| 4506 | 4506 | create_builtin_fn(g, BuiltinFnIdSetGlobalSection, "setGlobalSection", 2); |
src/ir_print.cpp+1-1| ... | ... | @@ -602,7 +602,7 @@ static void ir_print_truncate(IrPrint *irp, IrInstructionTruncate *instruction) |
| 602 | 602 | } |
| 603 | 603 | |
| 604 | 604 | static void ir_print_int_type(IrPrint *irp, IrInstructionIntType *instruction) { |
| 605 | fprintf(irp->f, "@intType("); | |
| 605 | fprintf(irp->f, "@IntType("); | |
| 606 | 606 | ir_print_other_instruction(irp, instruction->is_signed); |
| 607 | 607 | fprintf(irp->f, ", "); |
| 608 | 608 | ir_print_other_instruction(irp, instruction->bit_count); |
std/fmt.zig+1-1| ... | ... | @@ -222,7 +222,7 @@ pub fn formatInt(value: var, base: u8, uppercase: bool, width: usize, |
| 222 | 222 | fn formatIntSigned(value: var, base: u8, uppercase: bool, width: usize, |
| 223 | 223 | context: var, output: fn(@typeOf(context), []const u8)->bool) -> bool |
| 224 | 224 | { |
| 225 | const uint = @intType(false, @typeOf(value).bit_count); | |
| 225 | const uint = @IntType(false, @typeOf(value).bit_count); | |
| 226 | 226 | if (value < 0) { |
| 227 | 227 | const minus_sign: u8 = '-'; |
| 228 | 228 | if (!output(context, (&minus_sign)[0...1])) |
std/math.zig+1-1| ... | ... | @@ -62,7 +62,7 @@ pub fn abs(x: var) -> @typeOf(x) { |
| 62 | 62 | } |
| 63 | 63 | fn getReturnTypeForAbs(comptime T: type) -> type { |
| 64 | 64 | if (@isInteger(T)) { |
| 65 | return @intType(false, T.bit_count); | |
| 65 | return @IntType(false, T.bit_count); | |
| 66 | 66 | } else { |
| 67 | 67 | return T; |
| 68 | 68 | } |
std/mem.zig+1-1| ... | ... | @@ -167,7 +167,7 @@ pub fn readInt(bytes: []const u8, comptime T: type, big_endian: bool) -> T { |
| 167 | 167 | /// to fill the entire buffer provided. |
| 168 | 168 | /// value must be an integer. |
| 169 | 169 | pub fn writeInt(buf: []u8, value: var, big_endian: bool) { |
| 170 | const uint = @intType(false, @typeOf(value).bit_count); | |
| 170 | const uint = @IntType(false, @typeOf(value).bit_count); | |
| 171 | 171 | var bits = @truncate(uint, value); |
| 172 | 172 | if (big_endian) { |
| 173 | 173 | var index: usize = buf.len; |
std/os/child_process.zig+1-1| ... | ... | @@ -229,7 +229,7 @@ fn forkChildErrReport(fd: i32, err: error) -> noreturn { |
| 229 | 229 | posix.exit(1); |
| 230 | 230 | } |
| 231 | 231 | |
| 232 | const ErrInt = @intType(false, @sizeOf(error) * 8); | |
| 232 | const ErrInt = @IntType(false, @sizeOf(error) * 8); | |
| 233 | 233 | fn writeIntFd(fd: i32, value: ErrInt) -> %void { |
| 234 | 234 | var bytes: [@sizeOf(ErrInt)]u8 = undefined; |
| 235 | 235 | mem.writeInt(bytes[0...], value, true); |
std/rand.zig+1-1| ... | ... | @@ -84,7 +84,7 @@ pub const Rand = struct { |
| 84 | 84 | // const mask = ((1 << @float_mantissa_bit_count(T)) - 1); |
| 85 | 85 | // const rand_bits = r.rng.scalar(int) & mask; |
| 86 | 86 | // return @float_compose(T, false, 0, rand_bits) - 1.0 |
| 87 | const int_type = @intType(false, @sizeOf(T) * 8); | |
| 87 | const int_type = @IntType(false, @sizeOf(T) * 8); | |
| 88 | 88 | const precision = if (T == f32) { |
| 89 | 89 | 16777216 |
| 90 | 90 | } else if (T == f64) { |
test/cases/math.zig+1-1| ... | ... | @@ -152,7 +152,7 @@ fn testBinaryNot(x: u16) { |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | test "smallIntAddition" { |
| 155 | var x: @intType(false, 2) = 0; | |
| 155 | var x: @IntType(false, 2) = 0; | |
| 156 | 156 | assert(x == 0); |
| 157 | 157 | |
| 158 | 158 | x += 1; |
test/cases/misc.zig+13-13| ... | ... | @@ -19,16 +19,16 @@ test "callDisabledExternFn" { |
| 19 | 19 | disabledExternFn(); |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | test "intTypeBuiltin" { | |
| 23 | assert(@intType(true, 8) == i8); | |
| 24 | assert(@intType(true, 16) == i16); | |
| 25 | assert(@intType(true, 32) == i32); | |
| 26 | assert(@intType(true, 64) == i64); | |
| 22 | test "@IntType builtin" { | |
| 23 | assert(@IntType(true, 8) == i8); | |
| 24 | assert(@IntType(true, 16) == i16); | |
| 25 | assert(@IntType(true, 32) == i32); | |
| 26 | assert(@IntType(true, 64) == i64); | |
| 27 | 27 | |
| 28 | assert(@intType(false, 8) == u8); | |
| 29 | assert(@intType(false, 16) == u16); | |
| 30 | assert(@intType(false, 32) == u32); | |
| 31 | assert(@intType(false, 64) == u64); | |
| 28 | assert(@IntType(false, 8) == u8); | |
| 29 | assert(@IntType(false, 16) == u16); | |
| 30 | assert(@IntType(false, 32) == u32); | |
| 31 | assert(@IntType(false, 64) == u64); | |
| 32 | 32 | |
| 33 | 33 | assert(i8.bit_count == 8); |
| 34 | 34 | assert(i16.bit_count == 16); |
| ... | ... | @@ -48,10 +48,10 @@ test "intTypeBuiltin" { |
| 48 | 48 | assert(!usize.is_signed); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | const u1 = @intType(false, 1); | |
| 52 | const u63 = @intType(false, 63); | |
| 53 | const i1 = @intType(true, 1); | |
| 54 | const i63 = @intType(true, 63); | |
| 51 | const u1 = @IntType(false, 1); | |
| 52 | const u63 = @IntType(false, 63); | |
| 53 | const i1 = @IntType(true, 1); | |
| 54 | const i63 = @IntType(true, 63); | |
| 55 | 55 | |
| 56 | 56 | test "minValueAndMaxValue" { |
| 57 | 57 | assert(@maxValue(u1) == 1); |
test/cases/struct.zig+4-4| ... | ... | @@ -201,8 +201,8 @@ test "packedStruct" { |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | |
| 204 | const u2 = @intType(false, 2); | |
| 205 | const u3 = @intType(false, 3); | |
| 204 | const u2 = @IntType(false, 2); | |
| 205 | const u3 = @IntType(false, 3); | |
| 206 | 206 | |
| 207 | 207 | const BitField1 = packed struct { |
| 208 | 208 | a: u3, |
| ... | ... | @@ -243,7 +243,7 @@ fn getC(data: &const BitField1) -> u2 { |
| 243 | 243 | return data.c; |
| 244 | 244 | } |
| 245 | 245 | |
| 246 | const u24 = @intType(false, 24); | |
| 246 | const u24 = @IntType(false, 24); | |
| 247 | 247 | const Foo24Bits = packed struct { |
| 248 | 248 | field: u24, |
| 249 | 249 | }; |
| ... | ... | @@ -374,7 +374,7 @@ test "runtime struct initialization of bitfield" { |
| 374 | 374 | assert(s2.y == u4(x2)); |
| 375 | 375 | } |
| 376 | 376 | |
| 377 | const u4 = @intType(false, 4); | |
| 377 | const u4 = @IntType(false, 4); | |
| 378 | 378 | |
| 379 | 379 | var x1 = u4(1); |
| 380 | 380 | var x2 = u8(2); |
test/run_tests.cpp+3-3| ... | ... | @@ -1736,8 +1736,8 @@ fn bar(a: i32, b: []const u8) { |
| 1736 | 1736 | ".tmp_source.zig:3:17: note: called from here"); |
| 1737 | 1737 | |
| 1738 | 1738 | add_compile_fail_case("casting bit offset pointer to regular pointer", R"SOURCE( |
| 1739 | const u2 = @intType(false, 2); | |
| 1740 | const u3 = @intType(false, 3); | |
| 1739 | const u2 = @IntType(false, 2); | |
| 1740 | const u3 = @IntType(false, 3); | |
| 1741 | 1741 | |
| 1742 | 1742 | const BitField = packed struct { |
| 1743 | 1743 | a: u3, |
| ... | ... | @@ -1869,7 +1869,7 @@ export fn entry(a: &i32) -> usize { |
| 1869 | 1869 | |
| 1870 | 1870 | add_compile_fail_case("too many error values to cast to small integer", R"SOURCE( |
| 1871 | 1871 | error A; error B; error C; error D; error E; error F; error G; error H; |
| 1872 | const u2 = @intType(false, 2); | |
| 1872 | const u2 = @IntType(false, 2); | |
| 1873 | 1873 | fn foo(e: error) -> u2 { |
| 1874 | 1874 | return u2(e); |
| 1875 | 1875 | } |