mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2024-12-22 19:55:44 +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"
|
new GLib.AbiField("is_setup"
|
||||||
, -1
|
, -1
|
||||||
, (uint) sizeof (bool) // is_setup
|
, (uint) sizeof(uint) // is_setup
|
||||||
, "hook_size"
|
, "hook_size"
|
||||||
, "hooks"
|
, "hooks"
|
||||||
, 1
|
, 1
|
||||||
|
|
|
@ -237,6 +237,7 @@ namespace GtkSharp.Generation {
|
||||||
|
|
||||||
internal static string GetSizeOfExpression(string cstype)
|
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"
|
bool isBlittable = cstype == "IntPtr"
|
||||||
|| cstype == "UIntPtr"
|
|| cstype == "UIntPtr"
|
||||||
|| cstype == "ulong"
|
|| cstype == "ulong"
|
||||||
|
@ -247,11 +248,15 @@ namespace GtkSharp.Generation {
|
||||||
|| cstype == "short"
|
|| cstype == "short"
|
||||||
|| cstype == "byte"
|
|| cstype == "byte"
|
||||||
|| cstype == "sbyte"
|
|| cstype == "sbyte"
|
||||||
|| cstype == "char"
|
|| cstype == "float"
|
||||||
|| cstype == "byte";
|
|| cstype == "double";
|
||||||
if (isBlittable)
|
if (isBlittable)
|
||||||
return "sizeof( " + cstype + " )";
|
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 + ">()";
|
return "Marshal.SizeOf<" + cstype + ">()";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue