diff --git a/src/Externs.cs b/src/Externs.cs index 08b1407..0e16663 100644 --- a/src/Externs.cs +++ b/src/Externs.cs @@ -7,7 +7,7 @@ namespace Wasmtime [StructLayout(LayoutKind.Sequential)] internal record struct ExternFunc { - static ExternFunc() => Debug.Assert(Marshal.SizeOf(typeof(ExternFunc)) == 16); + static ExternFunc() => Debug.Assert(Marshal.SizeOf() == 16); public ulong store; public IntPtr __private; @@ -16,11 +16,11 @@ internal record struct ExternFunc [StructLayout(LayoutKind.Explicit)] internal record struct ExternTable { - static ExternTable() => Debug.Assert(Marshal.SizeOf(typeof(ExternTable)) == 24); + static ExternTable() => Debug.Assert(Marshal.SizeOf() == 24); // Use explicit offsets because the struct in the C api has extra padding // due to field alignments. The total struct size is 24 bytes. - + [FieldOffset(0)] public ulong store; [FieldOffset(8)] @@ -29,15 +29,15 @@ internal record struct ExternTable public uint __private2; } - + [StructLayout(LayoutKind.Explicit)] internal record struct ExternMemory { - static ExternMemory() => Debug.Assert(Marshal.SizeOf(typeof(ExternMemory)) == 24); + static ExternMemory() => Debug.Assert(Marshal.SizeOf() == 24); // Use explicit offsets because the struct in the C api has extra padding // due to field alignments. The total struct size is 24 bytes. - + [FieldOffset(0)] public ulong store; [FieldOffset(8)] @@ -49,7 +49,7 @@ internal record struct ExternMemory [StructLayout(LayoutKind.Sequential)] internal record struct ExternInstance { - static ExternInstance() => Debug.Assert(Marshal.SizeOf(typeof(ExternInstance)) == 16); + static ExternInstance() => Debug.Assert(Marshal.SizeOf() == 16); public ulong store; public nuint __private; @@ -58,7 +58,7 @@ internal record struct ExternInstance [StructLayout(LayoutKind.Sequential)] internal record struct ExternGlobal { - static ExternGlobal() => Debug.Assert(Marshal.SizeOf(typeof(ExternMemory)) == 24); + static ExternGlobal() => Debug.Assert(Marshal.SizeOf() == 24); public ulong store; public uint __private1; @@ -78,7 +78,7 @@ internal enum ExternKind : byte [StructLayout(LayoutKind.Explicit)] internal struct ExternUnion { - static ExternUnion() => Debug.Assert(Marshal.SizeOf(typeof(ExternUnion)) == 24); + static ExternUnion() => Debug.Assert(Marshal.SizeOf() == 24); [FieldOffset(0)] public ExternFunc func; @@ -99,8 +99,8 @@ internal struct ExternUnion [StructLayout(LayoutKind.Sequential)] internal struct Extern : IDisposable { - static Extern() => Debug.Assert(Marshal.SizeOf(typeof(Extern)) == 32); - + static Extern() => Debug.Assert(Marshal.SizeOf() == 32); + public ExternKind kind; public ExternUnion of; diff --git a/src/Wasmtime.csproj b/src/Wasmtime.csproj index 8cd90c8..c9fa5e4 100644 --- a/src/Wasmtime.csproj +++ b/src/Wasmtime.csproj @@ -46,7 +46,7 @@ The .NET embedding of Wasmtime enables .NET code to instantiate WebAssembly modu - + TextTemplatingFileGenerator