@@ -29,6 +29,11 @@ internal static int ReadInt32(BorrowedReference ob, int offset)
29
29
{
30
30
return Marshal . ReadInt32 ( ob . DangerousGetAddress ( ) , offset ) ;
31
31
}
32
+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
33
+ internal static long ReadInt64 ( BorrowedReference ob , int offset )
34
+ {
35
+ return Marshal . ReadInt64 ( ob . DangerousGetAddress ( ) , offset ) ;
36
+ }
32
37
33
38
[ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
34
39
internal unsafe static T * ReadPtr < T > ( BorrowedReference ob , int offset )
@@ -50,6 +55,21 @@ internal unsafe static BorrowedReference ReadRef(BorrowedReference @ref, int off
50
55
return new BorrowedReference ( ReadIntPtr ( @ref , offset ) ) ;
51
56
}
52
57
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
+ }
53
73
[ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
54
74
internal unsafe static void WriteRef ( BorrowedReference ob , int offset , in StolenReference @ref )
55
75
{
@@ -63,28 +83,28 @@ internal unsafe static void WriteNullableRef(BorrowedReference ob, int offset, i
63
83
}
64
84
65
85
66
- internal static Int64 ReadCLong ( IntPtr tp , int offset )
86
+ internal static Int64 ReadCLong ( BorrowedReference tp , int offset )
67
87
{
68
88
// On Windows, a C long is always 32 bits.
69
89
if ( Runtime . IsWindows || Runtime . Is32Bit )
70
90
{
71
- return Marshal . ReadInt32 ( tp , offset ) ;
91
+ return ReadInt32 ( tp , offset ) ;
72
92
}
73
93
else
74
94
{
75
- return Marshal . ReadInt64 ( tp , offset ) ;
95
+ return ReadInt64 ( tp , offset ) ;
76
96
}
77
97
}
78
98
79
- internal static void WriteCLong ( IntPtr type , int offset , Int64 flags )
99
+ internal static void WriteCLong ( BorrowedReference type , int offset , Int64 value )
80
100
{
81
101
if ( Runtime . IsWindows || Runtime . Is32Bit )
82
102
{
83
- Marshal . WriteInt32 ( type , offset , ( Int32 ) ( flags & 0xffffffffL ) ) ;
103
+ WriteInt32 ( type , offset , ( Int32 ) ( value & 0xffffffffL ) ) ;
84
104
}
85
105
else
86
106
{
87
- Marshal . WriteInt64 ( type , offset , flags ) ;
107
+ WriteInt64 ( type , offset , value ) ;
88
108
}
89
109
}
90
110
0 commit comments