File tree Expand file tree Collapse file tree 8 files changed +22
-22
lines changed Expand file tree Collapse file tree 8 files changed +22
-22
lines changed Original file line number Diff line number Diff line change @@ -75,15 +75,15 @@ public override unsafe MemoryHandle Pin(int elementIndex = 0)
75
75
ThrowArgumentOutOfRangeExceptionForInvalidIndex ( ) ;
76
76
}
77
77
78
- int bytePrefix = this . offset * sizeof ( TFrom ) ;
79
- int byteSuffix = elementIndex * sizeof ( TTo ) ;
80
- int byteOffset = bytePrefix + byteSuffix ;
78
+ nint bytePrefix = this . offset * sizeof ( TFrom ) ;
79
+ nint byteSuffix = elementIndex * sizeof ( TTo ) ;
80
+ nint byteOffset = bytePrefix + byteSuffix ;
81
81
82
82
GCHandle handle = GCHandle . Alloc ( this . array , GCHandleType . Pinned ) ;
83
83
84
84
ref TFrom r0 = ref this . array . DangerousGetReference ( ) ;
85
85
ref byte r1 = ref Unsafe . As < TFrom , byte > ( ref r0 ) ;
86
- ref byte r2 = ref Unsafe . Add ( ref r1 , byteOffset ) ;
86
+ ref byte r2 = ref Unsafe . AddByteOffset ( ref r1 , byteOffset ) ;
87
87
void * pi = Unsafe . AsPointer ( ref r2 ) ;
88
88
89
89
return new ( pi , handle ) ;
Original file line number Diff line number Diff line change @@ -71,15 +71,15 @@ public override unsafe MemoryHandle Pin(int elementIndex = 0)
71
71
ThrowArgumentOutOfRangeExceptionForInvalidIndex ( ) ;
72
72
}
73
73
74
- int bytePrefix = this . offset * sizeof ( char ) ;
75
- int byteSuffix = elementIndex * sizeof ( TTo ) ;
76
- int byteOffset = bytePrefix + byteSuffix ;
74
+ nint bytePrefix = this . offset * sizeof ( char ) ;
75
+ nint byteSuffix = elementIndex * sizeof ( TTo ) ;
76
+ nint byteOffset = bytePrefix + byteSuffix ;
77
77
78
78
GCHandle handle = GCHandle . Alloc ( this . text , GCHandleType . Pinned ) ;
79
79
80
80
ref char r0 = ref this . text . DangerousGetReference ( ) ;
81
81
ref byte r1 = ref Unsafe . As < char , byte > ( ref r0 ) ;
82
- ref byte r2 = ref Unsafe . Add ( ref r1 , byteOffset ) ;
82
+ ref byte r2 = ref Unsafe . AddByteOffset ( ref r1 , byteOffset ) ;
83
83
void * pi = Unsafe . AsPointer ( ref r2 ) ;
84
84
85
85
return new ( pi , handle ) ;
Original file line number Diff line number Diff line change @@ -37,9 +37,9 @@ namespace CommunityToolkit.HighPerformance;
37
37
private readonly object ? instance ;
38
38
39
39
/// <summary>
40
- /// The initial offset within <see cref="instance"/>.
40
+ /// The initial byte offset within <see cref="instance"/>.
41
41
/// </summary>
42
- private readonly IntPtr offset ;
42
+ private readonly nint offset ;
43
43
44
44
/// <summary>
45
45
/// The height of the specified 2D region.
@@ -603,7 +603,7 @@ public Span2D<T> Span
603
603
if ( this . instance is MemoryManager < T > memoryManager )
604
604
{
605
605
ref T r0 = ref memoryManager . GetSpan ( ) . DangerousGetReference ( ) ;
606
- ref T r1 = ref Unsafe . Add ( ref r0 , this . offset ) ;
606
+ ref T r1 = ref Unsafe . AddByteOffset ( ref r0 , this . offset ) ;
607
607
608
608
return new ( ref r1 , this . height , this . width , this . pitch ) ;
609
609
}
Original file line number Diff line number Diff line change @@ -34,9 +34,9 @@ namespace CommunityToolkit.HighPerformance;
34
34
private readonly object ? instance ;
35
35
36
36
/// <summary>
37
- /// The initial offset within <see cref="instance"/>.
37
+ /// The initial byte offset within <see cref="instance"/>.
38
38
/// </summary>
39
- private readonly IntPtr offset ;
39
+ private readonly nint offset ;
40
40
41
41
/// <summary>
42
42
/// The height of the specified 2D region.
@@ -615,7 +615,7 @@ public ReadOnlySpan2D<T> Span
615
615
if ( this . instance is MemoryManager < T > memoryManager )
616
616
{
617
617
ref T r0 = ref memoryManager . GetSpan ( ) . DangerousGetReference ( ) ;
618
- ref T r1 = ref Unsafe . Add ( ref r0 , this . offset ) ;
618
+ ref T r1 = ref Unsafe . AddByteOffset ( ref r0 , this . offset ) ;
619
619
620
620
return new ( in r1 , this . height , this . width , this . pitch ) ;
621
621
}
Original file line number Diff line number Diff line change @@ -109,9 +109,9 @@ public ref struct Enumerator
109
109
private readonly object ? instance ;
110
110
111
111
/// <summary>
112
- /// The initial offset within <see cref="instance"/>.
112
+ /// The initial byte offset within <see cref="instance"/>.
113
113
/// </summary>
114
- private readonly IntPtr offset ;
114
+ private readonly nint offset ;
115
115
116
116
/// <summary>
117
117
/// The height of the specified 2D region.
Original file line number Diff line number Diff line change @@ -50,9 +50,9 @@ public readonly ref partial struct ReadOnlySpan2D<T>
50
50
private readonly object ? instance ;
51
51
52
52
/// <summary>
53
- /// The initial offset within <see cref="instance"/>.
53
+ /// The initial byte offset within <see cref="instance"/>.
54
54
/// </summary>
55
- private readonly IntPtr offset ;
55
+ private readonly nint offset ;
56
56
57
57
/// <summary>
58
58
/// The height of the specified 2D region.
Original file line number Diff line number Diff line change @@ -109,9 +109,9 @@ public ref struct Enumerator
109
109
private readonly object ? instance ;
110
110
111
111
/// <summary>
112
- /// The initial offset within <see cref="instance"/>.
112
+ /// The initial byte offset within <see cref="instance"/>.
113
113
/// </summary>
114
- private readonly IntPtr offset ;
114
+ private readonly nint offset ;
115
115
116
116
/// <summary>
117
117
/// The height of the specified 2D region.
Original file line number Diff line number Diff line change @@ -82,9 +82,9 @@ public readonly ref partial struct Span2D<T>
82
82
internal readonly object ? Instance ;
83
83
84
84
/// <summary>
85
- /// The initial offset within <see cref="Instance"/>.
85
+ /// The initial byte offset within <see cref="Instance"/>.
86
86
/// </summary>
87
- internal readonly IntPtr Offset ;
87
+ internal readonly nint Offset ;
88
88
89
89
/// <summary>
90
90
/// The height of the specified 2D region.
You can’t perform that action at this time.
0 commit comments