Zig 0.17.0-dev (Split by item)
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 library itself.
Zig › ubsan_rt.zig › floatCastOverflow
floatCastOverflow
ubsan_rt.floatCastOverflow
fn floatCastOverflow (
data_handle : *align (8 ) const anyopaque ,
from_handle : ValueHandle ,
) callconv (.c ) noreturn
File
Code
fn floatCastOverflow (
data_handle : *align (8 ) const anyopaque ,
from_handle : ValueHandle ,
) callconv (.c ) noreturn {
// for more information on this check.
const ptr : [*]const u8 = @ptrCast (data_handle );
if (@as (u16 , ptr [0 ]) + @as (u16 , ptr [1 ]) < 2 or ptr [0 ] == 0xFF or ptr [1 ] == 0xFF ) {
const data : *const FloatCastOverflowData = @ptrCast (data_handle );
const from_value : Value = .{ .handle = from_handle , .td = data .from };
panic (@returnAddress (), "{f} is outside the range of representable values of type {s}" , .{
from_value , data .to .getName (),
});
} else {
const data : *const FloatCastOverflowDataV2 = @ptrCast (data_handle );
const from_value : Value = .{ .handle = from_handle , .td = data .from };
panic (@returnAddress (), "{f} is outside the range of representable values of type {s}" , .{
from_value , data .to .getName (),
});
}
}