std.Target: Rename c_type_* functions to camel case

From https://ziglang.org/documentation/master/#Names:

> If `x` is otherwise callable, then `x` should be `camelCase`.
This commit is contained in:
Linus Groh
2024-08-11 13:03:19 +01:00
parent fd434fcd38
commit 4ef956ef14
11 changed files with 109 additions and 109 deletions

View File

@@ -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,
},

View File

@@ -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,
};
}