Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle endianness for character tests #74082

Merged
merged 1 commit into from
Aug 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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