Function __builtin_object_size [src]
Prototype
pub inline fn __builtin_object_size(ptr: ?*const anyopaque, ty: c_int) usize
Parameters
ptr: ?*const anyopaque
ty: c_int
Source
pub inline fn __builtin_object_size(ptr: ?*const anyopaque, ty: c_int) usize {
_ = ptr;
// clang semantics match gcc's: https://gcc.gnu.org/onlinedocs/gcc/Object-Size-Checking.html
// If it is not possible to determine which objects ptr points to at compile time,
// __builtin_object_size should return (size_t) -1 for type 0 or 1 and (size_t) 0
// for type 2 or 3.
if (ty == 0 or ty == 1) return @as(usize, @bitCast(-@as(isize, 1)));
if (ty == 2 or ty == 3) return 0;
unreachable;
}