Definition at line 7 of file MemoryMarshalExtensions.cs.
◆ CreateReadOnlySpanFromNullTerminated()
| static unsafe ReadOnlySpan< byte > IKVM.Runtime.Extensions.MemoryMarshalExtensions.CreateReadOnlySpanFromNullTerminated |
( |
byte * | b | ) |
|
|
static |
Creates a ReadOnlySpan<byte> from the given pointer.
- Parameters
-
- Returns
Definition at line 35 of file MemoryMarshalExtensions.cs.
36 {
37#if NETFRAMEWORK
39#else
40 return MemoryMarshal.CreateReadOnlySpanFromNullTerminated(b);
41#endif
42 }
static unsafe int GetIndexOfNull(byte *ptr, int max=int.MaxValue)
Gets the length of a pointer to a C string.
◆ GetIndexOfNull()
| static unsafe int IKVM.Runtime.Extensions.MemoryMarshalExtensions.GetIndexOfNull |
( |
byte * | ptr, |
|
|
int | max = int::MaxValue ) |
|
static |
Gets the length of a pointer to a C string.
- Parameters
-
- Returns
Definition at line 16 of file MemoryMarshalExtensions.cs.
17 {
18 if (ptr is null)
19 throw new ArgumentNullException(nameof(ptr));
20 if (max < 0)
21 throw new ArgumentOutOfRangeException(nameof(max));
22
23 for (int i = 0; i < max; i++)
24 if (ptr[i] == 0)
25 return i;
26
27 return -1;
28 }
The documentation for this class was generated from the following file: