Skip to content

Commit

Permalink
Handle endianness for character tests (#74082)
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronRobinsonMSFT authored Aug 17, 2022
1 parent 6521c2b commit f142128
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ namespace LibraryImportGenerator.IntegrationTests
{
partial class NativeExportsNE
{
[LibraryImport(NativeExportsNE_Binary, EntryPoint = "unicode_return_as_uint", StringMarshalling = StringMarshalling.Utf16)]
[LibraryImport(NativeExportsNE_Binary, EntryPoint = "ushort_return_as_uint", StringMarshalling = StringMarshalling.Utf16)]
public static partial uint ReturnUnicodeAsUInt(char input);

[LibraryImport(NativeExportsNE_Binary, EntryPoint = "char_return_as_uint", StringMarshalling = StringMarshalling.Utf16)]
public static partial char ReturnUIntAsUnicode(uint input);

[LibraryImport(NativeExportsNE_Binary, EntryPoint = "char_return_as_refuint", StringMarshalling = StringMarshalling.Utf16)]
[LibraryImport(NativeExportsNE_Binary, EntryPoint = "char_return_as_refushort", StringMarshalling = StringMarshalling.Utf16)]
public static partial void ReturnUIntAsUnicode_Ref(uint input, ref char res);

[LibraryImport(NativeExportsNE_Binary, EntryPoint = "char_return_as_refuint", StringMarshalling = StringMarshalling.Utf16)]
[LibraryImport(NativeExportsNE_Binary, EntryPoint = "char_return_as_refushort", StringMarshalling = StringMarshalling.Utf16)]
public static partial void ReturnUIntAsUnicode_Out(uint input, out char res);

[LibraryImport(NativeExportsNE_Binary, EntryPoint = "char_return_as_refuint", StringMarshalling = StringMarshalling.Utf16)]
[LibraryImport(NativeExportsNE_Binary, EntryPoint = "char_return_as_refushort", StringMarshalling = StringMarshalling.Utf16)]
public static partial void ReturnUIntAsUnicode_In(uint input, in char res);

[LibraryImport(NativeExportsNE_Binary, EntryPoint = "char_return_as_uint", StringMarshalling = StringMarshalling.Utf8)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace NativeExports
{
public static unsafe class Characters
{
[UnmanagedCallersOnly(EntryPoint = "unicode_return_as_uint")]
[UnmanagedCallersOnly(EntryPoint = "ushort_return_as_uint")]
public static uint ReturnUnicodeAsUInt(ushort input)
{
return input;
Expand All @@ -20,10 +20,10 @@ public static uint ReturnUIntAsUInt(uint input)
return input;
}

[UnmanagedCallersOnly(EntryPoint = "char_return_as_refuint")]
public static void ReturnUIntAsRefUInt(uint input, uint* res)
[UnmanagedCallersOnly(EntryPoint = "char_return_as_refushort")]
public static void ReturnUIntAsRefUInt(uint input, ushort* res)
{
*res = input;
*res = (ushort)input;
}

[UnmanagedCallersOnly(EntryPoint = "char_reverse_buffer_ref")]
Expand Down

0 comments on commit f142128

Please sign in to comment.