Commit 4ef956ef14
Changed files (11)
lib
compiler
aro
std
src
lib/compiler/aro/aro/Parser.zig
@@ -5631,15 +5631,15 @@ pub const Result = struct {
};
const a_spec = a.ty.canonicalize(.standard).specifier;
const b_spec = b.ty.canonicalize(.standard).specifier;
- if (p.comp.target.c_type_bit_size(.longdouble) == 128) {
+ if (p.comp.target.cTypeBitSize(.longdouble) == 128) {
if (try a.floatConversion(b, a_spec, b_spec, p, float_types[0])) return;
}
if (try a.floatConversion(b, a_spec, b_spec, p, float_types[1])) return;
- if (p.comp.target.c_type_bit_size(.longdouble) == 80) {
+ if (p.comp.target.cTypeBitSize(.longdouble) == 80) {
if (try a.floatConversion(b, a_spec, b_spec, p, float_types[0])) return;
}
if (try a.floatConversion(b, a_spec, b_spec, p, float_types[2])) return;
- if (p.comp.target.c_type_bit_size(.longdouble) == 64) {
+ if (p.comp.target.cTypeBitSize(.longdouble) == 64) {
if (try a.floatConversion(b, a_spec, b_spec, p, float_types[0])) return;
}
if (try a.floatConversion(b, a_spec, b_spec, p, float_types[3])) return;
lib/compiler/aro/aro/target.zig
@@ -306,7 +306,7 @@ pub const FPSemantics = enum {
/// Only intended for generating float.h macros for the preprocessor
pub fn forType(ty: std.Target.CType, target: std.Target) FPSemantics {
std.debug.assert(ty == .float or ty == .double or ty == .longdouble);
- return switch (target.c_type_bit_size(ty)) {
+ return switch (target.cTypeBitSize(ty)) {
32 => .IEEESingle,
64 => .IEEEDouble,
80 => .x87ExtendedDouble,
@@ -350,7 +350,7 @@ pub const FPSemantics = enum {
};
pub fn isLP64(target: std.Target) bool {
- return target.c_type_bit_size(.int) == 32 and target.ptrBitWidth() == 64;
+ return target.cTypeBitSize(.int) == 32 and target.ptrBitWidth() == 64;
}
pub fn isKnownWindowsMSVCEnvironment(target: std.Target) bool {
lib/compiler/aro/aro/Type.zig
@@ -991,19 +991,19 @@ pub fn sizeof(ty: Type, comp: *const Compilation) ?u64 {
.incomplete_array => return if (comp.langopts.emulate == .msvc) @as(?u64, 0) else null,
.func, .var_args_func, .old_style_func, .void, .bool => 1,
.char, .schar, .uchar => 1,
- .short => comp.target.c_type_byte_size(.short),
- .ushort => comp.target.c_type_byte_size(.ushort),
- .int => comp.target.c_type_byte_size(.int),
- .uint => comp.target.c_type_byte_size(.uint),
- .long => comp.target.c_type_byte_size(.long),
- .ulong => comp.target.c_type_byte_size(.ulong),
- .long_long => comp.target.c_type_byte_size(.longlong),
- .ulong_long => comp.target.c_type_byte_size(.ulonglong),
- .long_double => comp.target.c_type_byte_size(.longdouble),
+ .short => comp.target.cTypeByteSize(.short),
+ .ushort => comp.target.cTypeByteSize(.ushort),
+ .int => comp.target.cTypeByteSize(.int),
+ .uint => comp.target.cTypeByteSize(.uint),
+ .long => comp.target.cTypeByteSize(.long),
+ .ulong => comp.target.cTypeByteSize(.ulong),
+ .long_long => comp.target.cTypeByteSize(.longlong),
+ .ulong_long => comp.target.cTypeByteSize(.ulonglong),
+ .long_double => comp.target.cTypeByteSize(.longdouble),
.int128, .uint128 => 16,
.fp16, .float16 => 2,
- .float => comp.target.c_type_byte_size(.float),
- .double => comp.target.c_type_byte_size(.double),
+ .float => comp.target.cTypeByteSize(.float),
+ .double => comp.target.cTypeByteSize(.double),
.float80 => 16,
.float128 => 16,
.bit_int => {
@@ -1049,7 +1049,7 @@ pub fn bitSizeof(ty: Type, comp: *const Compilation) ?u64 {
.typeof_expr => ty.data.expr.ty.bitSizeof(comp),
.attributed => ty.data.attributed.base.bitSizeof(comp),
.bit_int => return ty.data.int.bits,
- .long_double => comp.target.c_type_bit_size(.longdouble),
+ .long_double => comp.target.cTypeBitSize(.longdouble),
.float80 => return 80,
else => 8 * (ty.sizeof(comp) orelse return null),
};
@@ -1104,24 +1104,24 @@ pub fn alignof(ty: Type, comp: *const Compilation) u29 {
=> return ty.makeReal().alignof(comp),
// zig fmt: on
- .short => comp.target.c_type_alignment(.short),
- .ushort => comp.target.c_type_alignment(.ushort),
- .int => comp.target.c_type_alignment(.int),
- .uint => comp.target.c_type_alignment(.uint),
+ .short => comp.target.cTypeAlignment(.short),
+ .ushort => comp.target.cTypeAlignment(.ushort),
+ .int => comp.target.cTypeAlignment(.int),
+ .uint => comp.target.cTypeAlignment(.uint),
- .long => comp.target.c_type_alignment(.long),
- .ulong => comp.target.c_type_alignment(.ulong),
- .long_long => comp.target.c_type_alignment(.longlong),
- .ulong_long => comp.target.c_type_alignment(.ulonglong),
+ .long => comp.target.cTypeAlignment(.long),
+ .ulong => comp.target.cTypeAlignment(.ulong),
+ .long_long => comp.target.cTypeAlignment(.longlong),
+ .ulong_long => comp.target.cTypeAlignment(.ulonglong),
.bit_int => @min(
std.math.ceilPowerOfTwoPromote(u16, (ty.data.int.bits + 7) / 8),
16, // comp.target.maxIntAlignment(), please use your own logic for this value as it is implementation-defined
),
- .float => comp.target.c_type_alignment(.float),
- .double => comp.target.c_type_alignment(.double),
- .long_double => comp.target.c_type_alignment(.longdouble),
+ .float => comp.target.cTypeAlignment(.float),
+ .double => comp.target.cTypeAlignment(.double),
+ .long_double => comp.target.cTypeAlignment(.longdouble),
.int128, .uint128 => if (comp.target.cpu.arch == .s390x and comp.target.os.tag == .linux and comp.target.isGnu()) 8 else 16,
.fp16, .float16 => 2,
lib/std/Target.zig
@@ -2009,7 +2009,7 @@ pub const CType = enum {
longdouble,
};
-pub fn c_type_byte_size(t: Target, c_type: CType) u16 {
+pub fn cTypeByteSize(t: Target, c_type: CType) u16 {
return switch (c_type) {
.char,
.short,
@@ -2022,20 +2022,20 @@ pub fn c_type_byte_size(t: Target, c_type: CType) u16 {
.ulonglong,
.float,
.double,
- => @divExact(c_type_bit_size(t, c_type), 8),
+ => @divExact(cTypeBitSize(t, c_type), 8),
- .longdouble => switch (c_type_bit_size(t, c_type)) {
+ .longdouble => switch (cTypeBitSize(t, c_type)) {
16 => 2,
32 => 4,
64 => 8,
- 80 => @intCast(std.mem.alignForward(usize, 10, c_type_alignment(t, .longdouble))),
+ 80 => @intCast(std.mem.alignForward(usize, 10, cTypeAlignment(t, .longdouble))),
128 => 16,
else => unreachable,
},
};
}
-pub fn c_type_bit_size(target: Target, c_type: CType) u16 {
+pub fn cTypeBitSize(target: Target, c_type: CType) u16 {
switch (target.os.tag) {
.freestanding, .other => switch (target.cpu.arch) {
.msp430 => switch (c_type) {
@@ -2331,7 +2331,7 @@ pub fn c_type_bit_size(target: Target, c_type: CType) u16 {
}
}
-pub fn c_type_alignment(target: Target, c_type: CType) u16 {
+pub fn cTypeAlignment(target: Target, c_type: CType) u16 {
// Overrides for unusual alignments
switch (target.cpu.arch) {
.avr => return 1,
@@ -2351,7 +2351,7 @@ pub fn c_type_alignment(target: Target, c_type: CType) u16 {
// Next-power-of-two-aligned, up to a maximum.
return @min(
- std.math.ceilPowerOfTwoAssert(u16, (c_type_bit_size(target, c_type) + 7) / 8),
+ std.math.ceilPowerOfTwoAssert(u16, (cTypeBitSize(target, c_type) + 7) / 8),
@as(u16, switch (target.cpu.arch) {
.arm, .armeb, .thumb, .thumbeb => switch (target.os.tag) {
.netbsd => switch (target.abi) {
@@ -2423,7 +2423,7 @@ pub fn c_type_alignment(target: Target, c_type: CType) u16 {
);
}
-pub fn c_type_preferred_alignment(target: Target, c_type: CType) u16 {
+pub fn cTypePreferredAlignment(target: Target, c_type: CType) u16 {
// Overrides for unusual alignments
switch (target.cpu.arch) {
.arm, .armeb, .thumb, .thumbeb => switch (target.os.tag) {
@@ -2476,7 +2476,7 @@ pub fn c_type_preferred_alignment(target: Target, c_type: CType) u16 {
// Next-power-of-two-aligned, up to a maximum.
return @min(
- std.math.ceilPowerOfTwoAssert(u16, (c_type_bit_size(target, c_type) + 7) / 8),
+ std.math.ceilPowerOfTwoAssert(u16, (cTypeBitSize(target, c_type) + 7) / 8),
@as(u16, switch (target.cpu.arch) {
.msp430 => 2,
src/arch/riscv64/CodeGen.zig
@@ -8304,7 +8304,7 @@ fn promoteVarArg(func: *Func, ty: Type) Type {
switch (ty.floatBits(func.target.*)) {
32, 64 => return Type.f64,
else => |float_bits| {
- assert(float_bits == func.target.c_type_bit_size(.longdouble));
+ assert(float_bits == func.target.cTypeBitSize(.longdouble));
return Type.c_longdouble;
},
}
src/arch/x86_64/CodeGen.zig
@@ -19374,7 +19374,7 @@ fn promoteVarArg(self: *Self, ty: Type) Type {
switch (ty.floatBits(self.target.*)) {
32, 64 => return Type.f64,
else => |float_bits| {
- assert(float_bits == self.target.c_type_bit_size(.longdouble));
+ assert(float_bits == self.target.cTypeBitSize(.longdouble));
return Type.c_longdouble;
},
}
src/codegen/c/Type.zig
@@ -326,9 +326,9 @@ pub fn renderLiteralSuffix(ctype: CType, writer: anytype, pool: *const Pool) @Ty
pub fn floatActiveBits(ctype: CType, mod: *Module) u16 {
const target = &mod.resolved_target.result;
return switch (ctype.index) {
- .float => target.c_type_bit_size(.float),
- .double => target.c_type_bit_size(.double),
- .@"long double", .zig_c_longdouble => target.c_type_bit_size(.longdouble),
+ .float => target.cTypeBitSize(.float),
+ .double => target.cTypeBitSize(.double),
+ .@"long double", .zig_c_longdouble => target.cTypeBitSize(.longdouble),
.zig_f16 => 16,
.zig_f32 => 32,
.zig_f64 => 64,
@@ -344,17 +344,17 @@ pub fn byteSize(ctype: CType, pool: *const Pool, mod: *Module) u64 {
.basic => |basic_info| switch (basic_info) {
.void => 0,
.char, .@"signed char", ._Bool, .@"unsigned char", .bool, .uint8_t, .int8_t => 1,
- .short => target.c_type_byte_size(.short),
- .int => target.c_type_byte_size(.int),
- .long => target.c_type_byte_size(.long),
- .@"long long" => target.c_type_byte_size(.longlong),
- .@"unsigned short" => target.c_type_byte_size(.ushort),
- .@"unsigned int" => target.c_type_byte_size(.uint),
- .@"unsigned long" => target.c_type_byte_size(.ulong),
- .@"unsigned long long" => target.c_type_byte_size(.ulonglong),
- .float => target.c_type_byte_size(.float),
- .double => target.c_type_byte_size(.double),
- .@"long double" => target.c_type_byte_size(.longdouble),
+ .short => target.cTypeByteSize(.short),
+ .int => target.cTypeByteSize(.int),
+ .long => target.cTypeByteSize(.long),
+ .@"long long" => target.cTypeByteSize(.longlong),
+ .@"unsigned short" => target.cTypeByteSize(.ushort),
+ .@"unsigned int" => target.cTypeByteSize(.uint),
+ .@"unsigned long" => target.cTypeByteSize(.ulong),
+ .@"unsigned long long" => target.cTypeByteSize(.ulonglong),
+ .float => target.cTypeByteSize(.float),
+ .double => target.cTypeByteSize(.double),
+ .@"long double" => target.cTypeByteSize(.longdouble),
.size_t,
.ptrdiff_t,
.uintptr_t,
@@ -364,11 +364,11 @@ pub fn byteSize(ctype: CType, pool: *const Pool, mod: *Module) u64 {
.uint32_t, .int32_t, .zig_f32 => 4,
.uint64_t, .int64_t, .zig_f64 => 8,
.zig_u128, .zig_i128, .zig_f128 => 16,
- .zig_f80 => if (target.c_type_bit_size(.longdouble) == 80)
- target.c_type_byte_size(.longdouble)
+ .zig_f80 => if (target.cTypeBitSize(.longdouble) == 80)
+ target.cTypeByteSize(.longdouble)
else
16,
- .zig_c_longdouble => target.c_type_byte_size(.longdouble),
+ .zig_c_longdouble => target.cTypeByteSize(.longdouble),
.va_list => unreachable,
_ => unreachable,
},
src/codegen/llvm.zig
@@ -562,9 +562,9 @@ const DataLayoutBuilder = struct {
.float => &.{ .float, .double, .longdouble },
.vector, .aggregate => &.{},
})) |cty| {
- if (self.target.c_type_bit_size(cty) != size) continue;
- abi = self.target.c_type_alignment(cty) * 8;
- pref = self.target.c_type_preferred_alignment(cty) * 8;
+ if (self.target.cTypeBitSize(cty) != size) continue;
+ abi = self.target.cTypeAlignment(cty) * 8;
+ pref = self.target.cTypePreferredAlignment(cty) * 8;
break;
}
switch (kind) {
@@ -3120,7 +3120,7 @@ pub const Object = struct {
.c_ulong_type,
.c_longlong_type,
.c_ulonglong_type,
- => |tag| try o.builder.intType(target.c_type_bit_size(
+ => |tag| try o.builder.intType(target.cTypeBitSize(
@field(std.Target.CType, @tagName(tag)["c_".len .. @tagName(tag).len - "_type".len]),
)),
.c_longdouble_type,
@@ -11778,8 +11778,8 @@ fn backendSupportsF128(target: std.Target) bool {
fn intrinsicsAllowed(scalar_ty: Type, target: std.Target) bool {
return switch (scalar_ty.toIntern()) {
.f16_type => backendSupportsF16(target),
- .f80_type => (target.c_type_bit_size(.longdouble) == 80) and backendSupportsF80(target),
- .f128_type => (target.c_type_bit_size(.longdouble) == 128) and backendSupportsF128(target),
+ .f80_type => (target.cTypeBitSize(.longdouble) == 80) and backendSupportsF80(target),
+ .f128_type => (target.cTypeBitSize(.longdouble) == 128) and backendSupportsF128(target),
else => true,
};
}
src/Sema.zig
@@ -30943,7 +30943,7 @@ fn coerceVarArgParam(
.Array => return sema.fail(block, inst_src, "arrays must be passed by reference to variadic function", .{}),
.Float => float: {
const target = zcu.getTarget();
- const double_bits = target.c_type_bit_size(.double);
+ const double_bits = target.cTypeBitSize(.double);
const inst_bits = uncasted_ty.floatBits(target);
if (inst_bits >= double_bits) break :float inst;
switch (double_bits) {
@@ -30956,21 +30956,21 @@ fn coerceVarArgParam(
if (!try sema.validateExternType(uncasted_ty, .param_ty)) break :int inst;
const target = zcu.getTarget();
const uncasted_info = uncasted_ty.intInfo(zcu);
- if (uncasted_info.bits <= target.c_type_bit_size(switch (uncasted_info.signedness) {
+ if (uncasted_info.bits <= target.cTypeBitSize(switch (uncasted_info.signedness) {
.signed => .int,
.unsigned => .uint,
})) break :int try sema.coerce(block, switch (uncasted_info.signedness) {
.signed => Type.c_int,
.unsigned => Type.c_uint,
}, inst, inst_src);
- if (uncasted_info.bits <= target.c_type_bit_size(switch (uncasted_info.signedness) {
+ if (uncasted_info.bits <= target.cTypeBitSize(switch (uncasted_info.signedness) {
.signed => .long,
.unsigned => .ulong,
})) break :int try sema.coerce(block, switch (uncasted_info.signedness) {
.signed => Type.c_long,
.unsigned => Type.c_ulong,
}, inst, inst_src);
- if (uncasted_info.bits <= target.c_type_bit_size(switch (uncasted_info.signedness) {
+ if (uncasted_info.bits <= target.cTypeBitSize(switch (uncasted_info.signedness) {
.signed => .longlong,
.unsigned => .ulonglong,
})) break :int try sema.coerce(block, switch (uncasted_info.signedness) {
src/Type.zig
@@ -1005,15 +1005,15 @@ pub fn abiAlignmentAdvanced(
.f16 => return .{ .scalar = .@"2" },
.f32 => return .{ .scalar = cTypeAlign(target, .float) },
- .f64 => switch (target.c_type_bit_size(.double)) {
+ .f64 => switch (target.cTypeBitSize(.double)) {
64 => return .{ .scalar = cTypeAlign(target, .double) },
else => return .{ .scalar = .@"8" },
},
- .f80 => switch (target.c_type_bit_size(.longdouble)) {
+ .f80 => switch (target.cTypeBitSize(.longdouble)) {
80 => return .{ .scalar = cTypeAlign(target, .longdouble) },
else => return .{ .scalar = Type.u80.abiAlignment(pt) },
},
- .f128 => switch (target.c_type_bit_size(.longdouble)) {
+ .f128 => switch (target.cTypeBitSize(.longdouble)) {
128 => return .{ .scalar = cTypeAlign(target, .longdouble) },
else => return .{ .scalar = .@"16" },
},
@@ -1366,8 +1366,8 @@ pub fn abiSizeAdvanced(
.f32 => return .{ .scalar = 4 },
.f64 => return .{ .scalar = 8 },
.f128 => return .{ .scalar = 16 },
- .f80 => switch (target.c_type_bit_size(.longdouble)) {
- 80 => return .{ .scalar = target.c_type_byte_size(.longdouble) },
+ .f80 => switch (target.cTypeBitSize(.longdouble)) {
+ 80 => return .{ .scalar = target.cTypeByteSize(.longdouble) },
else => return .{ .scalar = Type.u80.abiSize(pt) },
},
@@ -1375,16 +1375,16 @@ pub fn abiSizeAdvanced(
.isize,
=> return .{ .scalar = @divExact(target.ptrBitWidth(), 8) },
- .c_char => return .{ .scalar = target.c_type_byte_size(.char) },
- .c_short => return .{ .scalar = target.c_type_byte_size(.short) },
- .c_ushort => return .{ .scalar = target.c_type_byte_size(.ushort) },
- .c_int => return .{ .scalar = target.c_type_byte_size(.int) },
- .c_uint => return .{ .scalar = target.c_type_byte_size(.uint) },
- .c_long => return .{ .scalar = target.c_type_byte_size(.long) },
- .c_ulong => return .{ .scalar = target.c_type_byte_size(.ulong) },
- .c_longlong => return .{ .scalar = target.c_type_byte_size(.longlong) },
- .c_ulonglong => return .{ .scalar = target.c_type_byte_size(.ulonglong) },
- .c_longdouble => return .{ .scalar = target.c_type_byte_size(.longdouble) },
+ .c_char => return .{ .scalar = target.cTypeByteSize(.char) },
+ .c_short => return .{ .scalar = target.cTypeByteSize(.short) },
+ .c_ushort => return .{ .scalar = target.cTypeByteSize(.ushort) },
+ .c_int => return .{ .scalar = target.cTypeByteSize(.int) },
+ .c_uint => return .{ .scalar = target.cTypeByteSize(.uint) },
+ .c_long => return .{ .scalar = target.cTypeByteSize(.long) },
+ .c_ulong => return .{ .scalar = target.cTypeByteSize(.ulong) },
+ .c_longlong => return .{ .scalar = target.cTypeByteSize(.longlong) },
+ .c_ulonglong => return .{ .scalar = target.cTypeByteSize(.ulonglong) },
+ .c_longdouble => return .{ .scalar = target.cTypeByteSize(.longdouble) },
.anyopaque,
.void,
@@ -1724,16 +1724,16 @@ pub fn bitSizeAdvanced(
.isize,
=> return target.ptrBitWidth(),
- .c_char => return target.c_type_bit_size(.char),
- .c_short => return target.c_type_bit_size(.short),
- .c_ushort => return target.c_type_bit_size(.ushort),
- .c_int => return target.c_type_bit_size(.int),
- .c_uint => return target.c_type_bit_size(.uint),
- .c_long => return target.c_type_bit_size(.long),
- .c_ulong => return target.c_type_bit_size(.ulong),
- .c_longlong => return target.c_type_bit_size(.longlong),
- .c_ulonglong => return target.c_type_bit_size(.ulonglong),
- .c_longdouble => return target.c_type_bit_size(.longdouble),
+ .c_char => return target.cTypeBitSize(.char),
+ .c_short => return target.cTypeBitSize(.short),
+ .c_ushort => return target.cTypeBitSize(.ushort),
+ .c_int => return target.cTypeBitSize(.int),
+ .c_uint => return target.cTypeBitSize(.uint),
+ .c_long => return target.cTypeBitSize(.long),
+ .c_ulong => return target.cTypeBitSize(.ulong),
+ .c_longlong => return target.cTypeBitSize(.longlong),
+ .c_ulonglong => return target.cTypeBitSize(.ulonglong),
+ .c_longdouble => return target.cTypeBitSize(.longdouble),
.bool => return 1,
.void => return 0,
@@ -2310,15 +2310,15 @@ pub fn intInfo(starting_ty: Type, mod: *Module) InternPool.Key.IntType {
},
.usize_type => return .{ .signedness = .unsigned, .bits = target.ptrBitWidth() },
.isize_type => return .{ .signedness = .signed, .bits = target.ptrBitWidth() },
- .c_char_type => return .{ .signedness = mod.getTarget().charSignedness(), .bits = target.c_type_bit_size(.char) },
- .c_short_type => return .{ .signedness = .signed, .bits = target.c_type_bit_size(.short) },
- .c_ushort_type => return .{ .signedness = .unsigned, .bits = target.c_type_bit_size(.ushort) },
- .c_int_type => return .{ .signedness = .signed, .bits = target.c_type_bit_size(.int) },
- .c_uint_type => return .{ .signedness = .unsigned, .bits = target.c_type_bit_size(.uint) },
- .c_long_type => return .{ .signedness = .signed, .bits = target.c_type_bit_size(.long) },
- .c_ulong_type => return .{ .signedness = .unsigned, .bits = target.c_type_bit_size(.ulong) },
- .c_longlong_type => return .{ .signedness = .signed, .bits = target.c_type_bit_size(.longlong) },
- .c_ulonglong_type => return .{ .signedness = .unsigned, .bits = target.c_type_bit_size(.ulonglong) },
+ .c_char_type => return .{ .signedness = mod.getTarget().charSignedness(), .bits = target.cTypeBitSize(.char) },
+ .c_short_type => return .{ .signedness = .signed, .bits = target.cTypeBitSize(.short) },
+ .c_ushort_type => return .{ .signedness = .unsigned, .bits = target.cTypeBitSize(.ushort) },
+ .c_int_type => return .{ .signedness = .signed, .bits = target.cTypeBitSize(.int) },
+ .c_uint_type => return .{ .signedness = .unsigned, .bits = target.cTypeBitSize(.uint) },
+ .c_long_type => return .{ .signedness = .signed, .bits = target.cTypeBitSize(.long) },
+ .c_ulong_type => return .{ .signedness = .unsigned, .bits = target.cTypeBitSize(.ulong) },
+ .c_longlong_type => return .{ .signedness = .signed, .bits = target.cTypeBitSize(.longlong) },
+ .c_ulonglong_type => return .{ .signedness = .unsigned, .bits = target.cTypeBitSize(.ulonglong) },
else => switch (ip.indexToKey(ty.toIntern())) {
.int_type => |int_type| return int_type,
.struct_type => ty = Type.fromInterned(ip.loadStructType(ty.toIntern()).backingIntTypeUnordered(ip)),
@@ -2427,7 +2427,7 @@ pub fn floatBits(ty: Type, target: Target) u16 {
.f64_type => 64,
.f80_type => 80,
.f128_type, .comptime_float_type => 128,
- .c_longdouble_type => target.c_type_bit_size(.longdouble),
+ .c_longdouble_type => target.cTypeBitSize(.longdouble),
else => unreachable,
};
@@ -4025,5 +4025,5 @@ pub fn smallestUnsignedBits(max: u64) u16 {
pub const packed_struct_layout_version = 2;
fn cTypeAlign(target: Target, c_type: Target.CType) Alignment {
- return Alignment.fromByteUnits(target.c_type_alignment(c_type));
+ return Alignment.fromByteUnits(target.cTypeAlignment(c_type));
}
tools/generate_c_size_and_align_checks.zig
@@ -8,7 +8,7 @@
const std = @import("std");
-fn c_name(ty: std.Target.CType) []const u8 {
+fn cName(ty: std.Target.CType) []const u8 {
return switch (ty) {
.char => "char",
.short => "short",
@@ -46,16 +46,16 @@ pub fn main() !void {
inline for (@typeInfo(std.Target.CType).Enum.fields) |field| {
const c_type: std.Target.CType = @enumFromInt(field.value);
try stdout.print("_Static_assert(sizeof({0s}) == {1d}, \"sizeof({0s}) == {1d}\");\n", .{
- c_name(c_type),
- target.c_type_byte_size(c_type),
+ cName(c_type),
+ target.cTypeByteSize(c_type),
});
try stdout.print("_Static_assert(_Alignof({0s}) == {1d}, \"_Alignof({0s}) == {1d}\");\n", .{
- c_name(c_type),
- target.c_type_alignment(c_type),
+ cName(c_type),
+ target.cTypeAlignment(c_type),
});
try stdout.print("_Static_assert(__alignof({0s}) == {1d}, \"__alignof({0s}) == {1d}\");\n\n", .{
- c_name(c_type),
- target.c_type_preferred_alignment(c_type),
+ cName(c_type),
+ target.cTypePreferredAlignment(c_type),
});
}
}