@@ -29,6 +29,11 @@ internal static int ReadInt32(BorrowedReference ob, int offset)
2929 {
3030 return Marshal . ReadInt32 ( ob . DangerousGetAddress ( ) , offset ) ;
3131 }
32+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
33+ internal static long ReadInt64 ( BorrowedReference ob , int offset )
34+ {
35+ return Marshal . ReadInt64 ( ob . DangerousGetAddress ( ) , offset ) ;
36+ }
3237
3338 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
3439 internal unsafe static T * ReadPtr < T > ( BorrowedReference ob , int offset )
@@ -50,6 +55,21 @@ internal unsafe static BorrowedReference ReadRef(BorrowedReference @ref, int off
5055 return new BorrowedReference ( ReadIntPtr ( @ref , offset ) ) ;
5156 }
5257
58+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
59+ internal static void WriteInt32 ( BorrowedReference ob , int offset , int value )
60+ {
61+ Marshal . WriteInt32 ( ob . DangerousGetAddress ( ) , offset , value ) ;
62+ }
63+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
64+ internal static void WriteInt64 ( BorrowedReference ob , int offset , long value )
65+ {
66+ Marshal . WriteInt64 ( ob . DangerousGetAddress ( ) , offset , value ) ;
67+ }
68+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
69+ internal unsafe static void WriteIntPtr ( BorrowedReference ob , int offset , IntPtr value )
70+ {
71+ Marshal . WriteIntPtr ( ob . DangerousGetAddress ( ) , offset , value ) ;
72+ }
5373 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
5474 internal unsafe static void WriteRef ( BorrowedReference ob , int offset , in StolenReference @ref )
5575 {
@@ -63,28 +83,28 @@ internal unsafe static void WriteNullableRef(BorrowedReference ob, int offset, i
6383 }
6484
6585
66- internal static Int64 ReadCLong ( IntPtr tp , int offset )
86+ internal static Int64 ReadCLong ( BorrowedReference tp , int offset )
6787 {
6888 // On Windows, a C long is always 32 bits.
6989 if ( Runtime . IsWindows || Runtime . Is32Bit )
7090 {
71- return Marshal . ReadInt32 ( tp , offset ) ;
91+ return ReadInt32 ( tp , offset ) ;
7292 }
7393 else
7494 {
75- return Marshal . ReadInt64 ( tp , offset ) ;
95+ return ReadInt64 ( tp , offset ) ;
7696 }
7797 }
7898
79- internal static void WriteCLong ( IntPtr type , int offset , Int64 flags )
99+ internal static void WriteCLong ( BorrowedReference type , int offset , Int64 value )
80100 {
81101 if ( Runtime . IsWindows || Runtime . Is32Bit )
82102 {
83- Marshal . WriteInt32 ( type , offset , ( Int32 ) ( flags & 0xffffffffL ) ) ;
103+ WriteInt32 ( type , offset , ( Int32 ) ( value & 0xffffffffL ) ) ;
84104 }
85105 else
86106 {
87- Marshal . WriteInt64 ( type , offset , flags ) ;
107+ WriteInt64 ( type , offset , value ) ;
88108 }
89109 }
90110
0 commit comments