Skip to content

Fix up IL of As() and AsPointer() to match the real Unsafe #1

Description

@rickbrew

See reference implementations here: https://github.com/dotnet/runtime/blob/main/src/libraries/System.Runtime.CompilerServices.Unsafe/src/System.Runtime.CompilerServices.Unsafe.il

and here: https://github.com/ltrzesniewski/InlineIL.Fody/blob/master/src/InlineIL.Examples/Unsafe.cs

Notice how AsPointer() uses conv.u and the other As() methods that return a ref are slightly different.

This may not make a difference in how the code runs but it may improve inlining. Might need to ask an expert for a review here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions