mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2024-12-22 13:55:39 +00:00
Address PR feedback
This commit is contained in:
parent
2c54a7824c
commit
1b73bc8042
|
@ -31,7 +31,7 @@ namespace GLib {
|
|||
),
|
||||
new GLib.AbiField("is_setup"
|
||||
, -1
|
||||
, (uint) sizeof (bool) // is_setup
|
||||
, (uint) sizeof(uint) // is_setup
|
||||
, "hook_size"
|
||||
, "hooks"
|
||||
, 1
|
||||
|
|
|
@ -237,6 +237,7 @@ namespace GtkSharp.Generation {
|
|||
|
||||
internal static string GetSizeOfExpression(string cstype)
|
||||
{
|
||||
// See https://docs.microsoft.com/en-us/dotnet/framework/interop/blittable-and-non-blittable-types
|
||||
bool isBlittable = cstype == "IntPtr"
|
||||
|| cstype == "UIntPtr"
|
||||
|| cstype == "ulong"
|
||||
|
@ -247,11 +248,15 @@ namespace GtkSharp.Generation {
|
|||
|| cstype == "short"
|
||||
|| cstype == "byte"
|
||||
|| cstype == "sbyte"
|
||||
|| cstype == "char"
|
||||
|| cstype == "byte";
|
||||
|| cstype == "float"
|
||||
|| cstype == "double";
|
||||
if (isBlittable)
|
||||
return "sizeof( " + cstype + " )";
|
||||
|
||||
// This is optimization based on https://github.com/GtkSharp/GtkSharp/pull/261#discussion_r673381869
|
||||
if (cstype == "bool")
|
||||
return "sizeof( uint )";
|
||||
|
||||
return "Marshal.SizeOf<" + cstype + ">()";
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue