File tree Expand file tree Collapse file tree 1 file changed +20
-6
lines changed
UnitTests/UnitTests.HighPerformance.Shared/Buffers/Internals Expand file tree Collapse file tree 1 file changed +20
-6
lines changed Original file line number Diff line number Diff line change 1
- using System ;
1
+ // Licensed to the .NET Foundation under one or more agreements.
2
+ // The .NET Foundation licenses this file to you under the MIT license.
3
+ // See the LICENSE file in the project root for more information.
4
+
5
+ using System ;
2
6
using System . Runtime . CompilerServices ;
3
7
using System . Runtime . InteropServices ;
4
8
@@ -31,6 +35,21 @@ public UnmanagedSpanOwner(int size)
31
35
this . length = size ;
32
36
}
33
37
38
+ /// <summary>
39
+ /// Gets the length of the buffer in use.
40
+ /// </summary>
41
+ public int Length => this . length ;
42
+
43
+ /// <summary>
44
+ /// Gets a pointer to the start of the buffer in use.
45
+ /// </summary>
46
+ public T * Ptr => ( T * ) this . ptr ;
47
+
48
+ /// <summary>
49
+ /// Gets the <see cref="Memory{T}"/> for the current instance.
50
+ /// </summary>
51
+ public Span < T > Span => new Span < T > ( ( void * ) this . ptr , this . length ) ;
52
+
34
53
/// <inheritdoc/>
35
54
public void Dispose ( )
36
55
{
@@ -45,10 +64,5 @@ public void Dispose()
45
64
46
65
Marshal . FreeHGlobal ( ptr ) ;
47
66
}
48
-
49
- /// <summary>
50
- /// Gets the <see cref="Memory{T}"/> for the current instance.
51
- /// </summary>
52
- public Span < T > Span => new Span < T > ( ( void * ) this . ptr , this . length ) ;
53
67
}
54
68
}
You can’t perform that action at this time.
0 commit comments