Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig standard library. Public Function

cTypeByteSize

Public Function
std.Target.cTypeByteSize
pub fn cTypeByteSize(t: *const Target, c_type: CType) ?u16

Returns null if no C ABI is defined for this target.

Params

File

Target.zig:3203
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
pub fn cTypeByteSize(t: *const Target, c_type: CType) ?u16 {
    return switch (c_type) {
        .char,
        .short,
        .ushort,
        .int,
        .uint,
        .long,
        .ulong,
        .longlong,
        .ulonglong,
        .float,
        .double,
        => @divExact(cTypeBitSize(t, c_type) orelse return null, 8),

        .longdouble => switch (cTypeBitSize(t, c_type) orelse return null) {
            64 => 8,
            80 => @intCast(std.mem.alignForward(usize, 10, cTypeAlignment(t, c_type).?)),
            128 => 16,
            else => unreachable,
        },
    };
}