| author | |
| committer | |
| log | 4bac22e88898158fc49e69db5bbe26a324797d68 |
| tree | 82c9845d2f113594f359339548bf949823413711 |
| parent | 67b4de33d2729fdb21337e5a0e05f6273bce23ba |
4 files changed, 25 insertions(+), 25 deletions(-)
doc/langref.html.in+7-7| ... | ... | @@ -6827,18 +6827,18 @@ pub const TypeInfo = union(TypeId) { |
| 6827 | 6827 | |
| 6828 | 6828 | pub const Int = struct { |
| 6829 | 6829 | is_signed: bool, |
| 6830 | bits: u8, | |
| 6830 | bits: comptime_int, | |
| 6831 | 6831 | }; |
| 6832 | 6832 | |
| 6833 | 6833 | pub const Float = struct { |
| 6834 | bits: u8, | |
| 6834 | bits: comptime_int, | |
| 6835 | 6835 | }; |
| 6836 | 6836 | |
| 6837 | 6837 | pub const Pointer = struct { |
| 6838 | 6838 | size: Size, |
| 6839 | 6839 | is_const: bool, |
| 6840 | 6840 | is_volatile: bool, |
| 6841 | alignment: u32, | |
| 6841 | alignment: comptime_int, | |
| 6842 | 6842 | child: type, |
| 6843 | 6843 | |
| 6844 | 6844 | pub const Size = enum { |
| ... | ... | @@ -6849,7 +6849,7 @@ pub const TypeInfo = union(TypeId) { |
| 6849 | 6849 | }; |
| 6850 | 6850 | |
| 6851 | 6851 | pub const Array = struct { |
| 6852 | len: usize, | |
| 6852 | len: comptime_int, | |
| 6853 | 6853 | child: type, |
| 6854 | 6854 | }; |
| 6855 | 6855 | |
| ... | ... | @@ -6861,7 +6861,7 @@ pub const TypeInfo = union(TypeId) { |
| 6861 | 6861 | |
| 6862 | 6862 | pub const StructField = struct { |
| 6863 | 6863 | name: []const u8, |
| 6864 | offset: ?usize, | |
| 6864 | offset: ?comptime_int, | |
| 6865 | 6865 | field_type: type, |
| 6866 | 6866 | }; |
| 6867 | 6867 | |
| ... | ... | @@ -6882,7 +6882,7 @@ pub const TypeInfo = union(TypeId) { |
| 6882 | 6882 | |
| 6883 | 6883 | pub const Error = struct { |
| 6884 | 6884 | name: []const u8, |
| 6885 | value: usize, | |
| 6885 | value: comptime_int, | |
| 6886 | 6886 | }; |
| 6887 | 6887 | |
| 6888 | 6888 | pub const ErrorSet = struct { |
| ... | ... | @@ -6891,7 +6891,7 @@ pub const TypeInfo = union(TypeId) { |
| 6891 | 6891 | |
| 6892 | 6892 | pub const EnumField = struct { |
| 6893 | 6893 | name: []const u8, |
| 6894 | value: usize, | |
| 6894 | value: comptime_int, | |
| 6895 | 6895 | }; |
| 6896 | 6896 | |
| 6897 | 6897 | pub const Enum = struct { |
src/codegen.cpp+8-8| ... | ... | @@ -7492,18 +7492,18 @@ Buf *codegen_generate_builtin_source(CodeGen *g) { |
| 7492 | 7492 | "\n\n" |
| 7493 | 7493 | " pub const Int = struct {\n" |
| 7494 | 7494 | " is_signed: bool,\n" |
| 7495 | " bits: u8,\n" | |
| 7495 | " bits: comptime_int,\n" | |
| 7496 | 7496 | " };\n" |
| 7497 | 7497 | "\n" |
| 7498 | 7498 | " pub const Float = struct {\n" |
| 7499 | " bits: u8,\n" | |
| 7499 | " bits: comptime_int,\n" | |
| 7500 | 7500 | " };\n" |
| 7501 | 7501 | "\n" |
| 7502 | 7502 | " pub const Pointer = struct {\n" |
| 7503 | 7503 | " size: Size,\n" |
| 7504 | 7504 | " is_const: bool,\n" |
| 7505 | 7505 | " is_volatile: bool,\n" |
| 7506 | " alignment: u32,\n" | |
| 7506 | " alignment: comptime_int,\n" | |
| 7507 | 7507 | " child: type,\n" |
| 7508 | 7508 | "\n" |
| 7509 | 7509 | " pub const Size = enum {\n" |
| ... | ... | @@ -7515,7 +7515,7 @@ Buf *codegen_generate_builtin_source(CodeGen *g) { |
| 7515 | 7515 | " };\n" |
| 7516 | 7516 | "\n" |
| 7517 | 7517 | " pub const Array = struct {\n" |
| 7518 | " len: usize,\n" | |
| 7518 | " len: comptime_int,\n" | |
| 7519 | 7519 | " child: type,\n" |
| 7520 | 7520 | " };\n" |
| 7521 | 7521 | "\n" |
| ... | ... | @@ -7527,7 +7527,7 @@ Buf *codegen_generate_builtin_source(CodeGen *g) { |
| 7527 | 7527 | "\n" |
| 7528 | 7528 | " pub const StructField = struct {\n" |
| 7529 | 7529 | " name: []const u8,\n" |
| 7530 | " offset: ?usize,\n" | |
| 7530 | " offset: ?comptime_int,\n" | |
| 7531 | 7531 | " field_type: type,\n" |
| 7532 | 7532 | " };\n" |
| 7533 | 7533 | "\n" |
| ... | ... | @@ -7548,7 +7548,7 @@ Buf *codegen_generate_builtin_source(CodeGen *g) { |
| 7548 | 7548 | "\n" |
| 7549 | 7549 | " pub const Error = struct {\n" |
| 7550 | 7550 | " name: []const u8,\n" |
| 7551 | " value: usize,\n" | |
| 7551 | " value: comptime_int,\n" | |
| 7552 | 7552 | " };\n" |
| 7553 | 7553 | "\n" |
| 7554 | 7554 | " pub const ErrorSet = struct {\n" |
| ... | ... | @@ -7557,7 +7557,7 @@ Buf *codegen_generate_builtin_source(CodeGen *g) { |
| 7557 | 7557 | "\n" |
| 7558 | 7558 | " pub const EnumField = struct {\n" |
| 7559 | 7559 | " name: []const u8,\n" |
| 7560 | " value: usize,\n" | |
| 7560 | " value: comptime_int,\n" | |
| 7561 | 7561 | " };\n" |
| 7562 | 7562 | "\n" |
| 7563 | 7563 | " pub const Enum = struct {\n" |
| ... | ... | @@ -7609,7 +7609,7 @@ Buf *codegen_generate_builtin_source(CodeGen *g) { |
| 7609 | 7609 | " };\n" |
| 7610 | 7610 | "\n" |
| 7611 | 7611 | " pub const Vector = struct {\n" |
| 7612 | " len: u32,\n" | |
| 7612 | " len: comptime_int,\n" | |
| 7613 | 7613 | " child: type,\n" |
| 7614 | 7614 | " };\n" |
| 7615 | 7615 | "\n" |
src/ir.cpp+8-8| ... | ... | @@ -17997,7 +17997,7 @@ static ConstExprValue *create_ptr_like_type_info(IrAnalyze *ira, ZigType *ptr_ty |
| 17997 | 17997 | // alignment: u32 |
| 17998 | 17998 | ensure_field_index(result->type, "alignment", 3); |
| 17999 | 17999 | fields[3].special = ConstValSpecialStatic; |
| 18000 | fields[3].type = get_int_type(ira->codegen, false, 29); | |
| 18000 | fields[3].type = ira->codegen->builtin_types.entry_num_lit_int; | |
| 18001 | 18001 | bigint_init_unsigned(&fields[3].data.x_bigint, get_ptr_align(ira->codegen, attrs_type)); |
| 18002 | 18002 | // child: type |
| 18003 | 18003 | ensure_field_index(result->type, "child", 4); |
| ... | ... | @@ -18016,7 +18016,7 @@ static void make_enum_field_val(IrAnalyze *ira, ConstExprValue *enum_field_val, |
| 18016 | 18016 | |
| 18017 | 18017 | ConstExprValue *inner_fields = create_const_vals(2); |
| 18018 | 18018 | inner_fields[1].special = ConstValSpecialStatic; |
| 18019 | inner_fields[1].type = ira->codegen->builtin_types.entry_usize; | |
| 18019 | inner_fields[1].type = ira->codegen->builtin_types.entry_num_lit_int; | |
| 18020 | 18020 | |
| 18021 | 18021 | ConstExprValue *name = create_const_str_lit(ira->codegen, enum_field->name); |
| 18022 | 18022 | init_const_slice(ira->codegen, &inner_fields[0], name, 0, buf_len(enum_field->name), true); |
| ... | ... | @@ -18080,7 +18080,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInstruction *source_instr |
| 18080 | 18080 | // bits: u8 |
| 18081 | 18081 | ensure_field_index(result->type, "bits", 1); |
| 18082 | 18082 | fields[1].special = ConstValSpecialStatic; |
| 18083 | fields[1].type = ira->codegen->builtin_types.entry_u8; | |
| 18083 | fields[1].type = ira->codegen->builtin_types.entry_num_lit_int; | |
| 18084 | 18084 | bigint_init_unsigned(&fields[1].data.x_bigint, type_entry->data.integral.bit_count); |
| 18085 | 18085 | |
| 18086 | 18086 | break; |
| ... | ... | @@ -18097,7 +18097,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInstruction *source_instr |
| 18097 | 18097 | // bits: u8 |
| 18098 | 18098 | ensure_field_index(result->type, "bits", 0); |
| 18099 | 18099 | fields[0].special = ConstValSpecialStatic; |
| 18100 | fields[0].type = ira->codegen->builtin_types.entry_u8; | |
| 18100 | fields[0].type = ira->codegen->builtin_types.entry_num_lit_int; | |
| 18101 | 18101 | bigint_init_unsigned(&fields->data.x_bigint, type_entry->data.floating.bit_count); |
| 18102 | 18102 | |
| 18103 | 18103 | break; |
| ... | ... | @@ -18121,7 +18121,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInstruction *source_instr |
| 18121 | 18121 | // len: usize |
| 18122 | 18122 | ensure_field_index(result->type, "len", 0); |
| 18123 | 18123 | fields[0].special = ConstValSpecialStatic; |
| 18124 | fields[0].type = ira->codegen->builtin_types.entry_usize; | |
| 18124 | fields[0].type = ira->codegen->builtin_types.entry_num_lit_int; | |
| 18125 | 18125 | bigint_init_unsigned(&fields[0].data.x_bigint, type_entry->data.array.len); |
| 18126 | 18126 | // child: type |
| 18127 | 18127 | ensure_field_index(result->type, "child", 1); |
| ... | ... | @@ -18142,7 +18142,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInstruction *source_instr |
| 18142 | 18142 | // len: usize |
| 18143 | 18143 | ensure_field_index(result->type, "len", 0); |
| 18144 | 18144 | fields[0].special = ConstValSpecialStatic; |
| 18145 | fields[0].type = ira->codegen->builtin_types.entry_u32; | |
| 18145 | fields[0].type = ira->codegen->builtin_types.entry_num_lit_int; | |
| 18146 | 18146 | bigint_init_unsigned(&fields[0].data.x_bigint, type_entry->data.vector.len); |
| 18147 | 18147 | // child: type |
| 18148 | 18148 | ensure_field_index(result->type, "child", 1); |
| ... | ... | @@ -18286,7 +18286,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInstruction *source_instr |
| 18286 | 18286 | |
| 18287 | 18287 | ConstExprValue *inner_fields = create_const_vals(2); |
| 18288 | 18288 | inner_fields[1].special = ConstValSpecialStatic; |
| 18289 | inner_fields[1].type = ira->codegen->builtin_types.entry_usize; | |
| 18289 | inner_fields[1].type = ira->codegen->builtin_types.entry_num_lit_int; | |
| 18290 | 18290 | |
| 18291 | 18291 | ConstExprValue *name = nullptr; |
| 18292 | 18292 | if (error->cached_error_name_val != nullptr) |
| ... | ... | @@ -18458,7 +18458,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInstruction *source_instr |
| 18458 | 18458 | |
| 18459 | 18459 | ConstExprValue *inner_fields = create_const_vals(3); |
| 18460 | 18460 | inner_fields[1].special = ConstValSpecialStatic; |
| 18461 | inner_fields[1].type = get_optional_type(ira->codegen, ira->codegen->builtin_types.entry_usize); | |
| 18461 | inner_fields[1].type = get_optional_type(ira->codegen, ira->codegen->builtin_types.entry_num_lit_int); | |
| 18462 | 18462 | |
| 18463 | 18463 | if (!type_has_bits(struct_field->type_entry)) { |
| 18464 | 18464 | inner_fields[1].data.x_optional = nullptr; |
std/math/index.zig+2-2| ... | ... | @@ -738,14 +738,14 @@ test "math.f64_min" { |
| 738 | 738 | |
| 739 | 739 | pub fn maxInt(comptime T: type) comptime_int { |
| 740 | 740 | const info = @typeInfo(T); |
| 741 | const bit_count = comptime_int(info.Int.bits); // TODO #1683 | |
| 741 | const bit_count = info.Int.bits; | |
| 742 | 742 | if (bit_count == 0) return 0; |
| 743 | 743 | return (1 << (bit_count - @boolToInt(info.Int.is_signed))) - 1; |
| 744 | 744 | } |
| 745 | 745 | |
| 746 | 746 | pub fn minInt(comptime T: type) comptime_int { |
| 747 | 747 | const info = @typeInfo(T); |
| 748 | const bit_count = comptime_int(info.Int.bits); // TODO #1683 | |
| 748 | const bit_count = info.Int.bits; | |
| 749 | 749 | if (!info.Int.is_signed) return 0; |
| 750 | 750 | if (bit_count == 0) return 0; |
| 751 | 751 | return -(1 << (bit_count - 1)); |