public static function castCTypeOrCData(CData|CType
$data, array
$args, Stub
$stub): array
{ if ($data instanceof CType
) { $type =
$data;
$data = null;
} else { $type = \FFI::
typeof($data);
} $stub->class =
sprintf('%s<%s> size %d align %d',
($data ??
$type)::
class,
$type->
getName(),
$type->
getSize(),
$type->
getAlignment());
return match ($type->
getKind()) { CType::TYPE_FLOAT,
CType::TYPE_DOUBLE,
\
defined('\FFI\CType::TYPE_LONGDOUBLE'
) ? CType::TYPE_LONGDOUBLE : -1,
CType::TYPE_UINT8,
CType::TYPE_SINT8,
CType::TYPE_UINT16,
CType::TYPE_SINT16,
CType::TYPE_UINT32,
CType::TYPE_SINT32,
CType::TYPE_UINT64,
CType::TYPE_SINT64,