Skip to content

Instantly share code, notes, and snippets.

@AntonNik0laev
Created February 4, 2015 15:22
Show Gist options
  • Save AntonNik0laev/621ceebedb705b5c9c49 to your computer and use it in GitHub Desktop.
Save AntonNik0laev/621ceebedb705b5c9c49 to your computer and use it in GitHub Desktop.
.assembly EntityPtr { }
.class public System.Runtime.CLR.EntityPtr
{
.method public static native int ToPointer<TType> ( !!TType input)
{
ldarg.0
conv.i4
ldc.i4 4
sub
conv.i
ret
}
.method public static native int ToPointerWithOffset<TType> ( !!TType input)
{
ldarg.0
ret
}
.method public static !!TType ToInstance<TType> ( native int input)
{
ldarg.0
conv.i4
ldc.i4 4
add
conv.i
ret
}
.method public static !!TType ToInstanceWithOffset<TType> ( native int input)
{
ldarg.0
ret
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment