| ... | ... | @@ -1110,7 +1110,6 @@ pub const DeclGen = struct { |
| 1110 | 1110 | // MSVC throws C2078 if an array of size 65536 or greater is initialized with a string literal |
| 1111 | 1111 | const max_string_initializer_len = 65535; |
| 1112 | 1112 | |
| 1113 | | |
| 1114 | 1113 | const ai = ty.arrayInfo(); |
| 1115 | 1114 | if (ai.elem_type.eql(Type.u8, dg.module)) { |
| 1116 | 1115 | if (ai.len <= max_string_initializer_len) { |
| ... | ... | @@ -1134,7 +1133,7 @@ pub const DeclGen = struct { |
| 1134 | 1133 | if (index != 0) try writer.writeByte(','); |
| 1135 | 1134 | const elem_val = try val.elemValue(dg.module, arena_allocator, index); |
| 1136 | 1135 | const elem_val_u8 = if (elem_val.isUndef()) undefPattern(u8) else @intCast(u8, elem_val.toUnsignedInt(target)); |
| 1137 | | try writer.print("'\\x{x}'", .{ elem_val_u8 }); |
| 1136 | try writer.print("'\\x{x}'", .{elem_val_u8}); |
| 1138 | 1137 | } |
| 1139 | 1138 | if (ai.sentinel) |s| { |
| 1140 | 1139 | if (index != 0) try writer.writeByte(','); |
| ... | ... | @@ -1350,7 +1349,7 @@ pub const DeclGen = struct { |
| 1350 | 1349 | try dg.renderIntCast(writer, ty, cast_context, field_ty, .FunctionArgument); |
| 1351 | 1350 | } |
| 1352 | 1351 | |
| 1353 | | if (needs_closing_paren) try writer.writeByte(')') ; |
| 1352 | if (needs_closing_paren) try writer.writeByte(')'); |
| 1354 | 1353 | if (eff_index != eff_num_fields - 1) try writer.writeAll(", "); |
| 1355 | 1354 | |
| 1356 | 1355 | bit_offset_val_pl.data += field_ty.bitSize(target); |
| ... | ... | @@ -2254,7 +2253,7 @@ pub const DeclGen = struct { |
| 2254 | 2253 | if (dest_bits <= 64 and src_bits <= 64) { |
| 2255 | 2254 | const needs_cast = src_int_info == null or |
| 2256 | 2255 | (toCIntBits(dest_int_info.bits) != toCIntBits(src_int_info.?.bits) or |
| 2257 | | dest_int_info.signedness != src_int_info.?.signedness); |
| 2256 | dest_int_info.signedness != src_int_info.?.signedness); |
| 2258 | 2257 | |
| 2259 | 2258 | if (needs_cast) { |
| 2260 | 2259 | try w.writeByte('('); |
| ... | ... | @@ -2567,7 +2566,7 @@ pub const DeclGen = struct { |
| 2567 | 2566 | } else if (ty.isRuntimeFloat()) { |
| 2568 | 2567 | try ty.print(writer, dg.module); |
| 2569 | 2568 | } else if (ty.isPtrAtRuntime()) { |
| 2570 | | try writer.print("p{d}", .{ ty.bitSize(target) }); |
| 2569 | try writer.print("p{d}", .{ty.bitSize(target)}); |
| 2571 | 2570 | } else if (ty.zigTypeTag() == .Bool) { |
| 2572 | 2571 | try writer.print("u8", .{}); |
| 2573 | 2572 | } else return dg.fail("TODO: CBE: implement renderTypeForBuiltinFnName for type {}", .{ |
| ... | ... | @@ -2633,12 +2632,7 @@ pub const DeclGen = struct { |
| 2633 | 2632 | const c_bits = toCIntBits(int_info.bits); |
| 2634 | 2633 | if (c_bits == null or c_bits.? > 128) |
| 2635 | 2634 | return dg.fail("TODO implement integer constants larger than 128 bits", .{}); |
| 2636 | | return std.fmt.Formatter(formatIntLiteral){ .data = .{ |
| 2637 | | .ty = ty, |
| 2638 | | .val = val, |
| 2639 | | .mod = dg.module, |
| 2640 | | .location = location |
| 2641 | | } }; |
| 2635 | return std.fmt.Formatter(formatIntLiteral){ .data = .{ .ty = ty, .val = val, .mod = dg.module, .location = location } }; |
| 2642 | 2636 | } |
| 2643 | 2637 | }; |
| 2644 | 2638 | |
| ... | ... | @@ -3668,9 +3662,9 @@ fn airTrunc(f: *Function, inst: Air.Inst.Index) !CValue { |
| 3668 | 3662 | } |
| 3669 | 3663 | try f.writeCValue(writer, operand, .FunctionArgument); |
| 3670 | 3664 | if (c_bits == 128) try writer.writeByte(')'); |
| 3671 | | try writer.print(", {})", .{ try f.fmtIntLiteral(Type.u8, shift_val) }); |
| 3665 | try writer.print(", {})", .{try f.fmtIntLiteral(Type.u8, shift_val)}); |
| 3672 | 3666 | if (c_bits == 128) try writer.writeByte(')'); |
| 3673 | | try writer.print(", {})", .{ try f.fmtIntLiteral(Type.u8, shift_val) }); |
| 3667 | try writer.print(", {})", .{try f.fmtIntLiteral(Type.u8, shift_val)}); |
| 3674 | 3668 | }, |
| 3675 | 3669 | } |
| 3676 | 3670 | |
| ... | ... | @@ -7227,12 +7221,7 @@ fn undefPattern(comptime IntType: type) IntType { |
| 7227 | 7221 | return @bitCast(IntType, @as(UnsignedType, (1 << (int_info.bits | 1)) / 3)); |
| 7228 | 7222 | } |
| 7229 | 7223 | |
| 7230 | | const FormatIntLiteralContext = struct { |
| 7231 | | ty: Type, |
| 7232 | | val: Value, |
| 7233 | | mod: *Module, |
| 7234 | | location: ?ValueRenderLocation = null |
| 7235 | | }; |
| 7224 | const FormatIntLiteralContext = struct { ty: Type, val: Value, mod: *Module, location: ?ValueRenderLocation = null }; |
| 7236 | 7225 | fn formatIntLiteral( |
| 7237 | 7226 | data: FormatIntLiteralContext, |
| 7238 | 7227 | comptime fmt: []const u8, |
| ... | ... | @@ -7324,7 +7313,7 @@ fn formatIntLiteral( |
| 7324 | 7313 | } else { |
| 7325 | 7314 | try writer.print("zig_as_{c}{d}(", .{ signAbbrev(int_info.signedness), c_bits }); |
| 7326 | 7315 | } |
| 7327 | | } |
| 7316 | }, |
| 7328 | 7317 | } |
| 7329 | 7318 | |
| 7330 | 7319 | const limbs_count_64 = @divExact(64, @bitSizeOf(BigIntLimb)); |