12
12
13
13
namespace BizHawk . Common
14
14
{
15
- public static unsafe class Util
15
+ public static class Util
16
16
{
17
17
[ Conditional ( "DEBUG" ) ]
18
18
public static void BreakDebuggerIfAttached ( )
@@ -147,26 +147,6 @@ static int CharToNybble(char c)
147
147
return ms . ToArray ( ) ;
148
148
}
149
149
150
- public static int Memcmp ( void * a , void * b , int len )
151
- {
152
- var ba = ( byte * ) a ;
153
- var bb = ( byte * ) b ;
154
- for ( var i = 0 ; i != len ; i ++ )
155
- {
156
- var _a = ba [ i ] ;
157
- var _b = bb [ i ] ;
158
- var c = _a - _b ;
159
- if ( c != 0 ) return c ;
160
- }
161
- return 0 ;
162
- }
163
-
164
- public static void Memset ( void * ptr , int val , int len )
165
- {
166
- var bptr = ( byte * ) ptr ;
167
- for ( var i = 0 ; i != len ; i ++ ) bptr [ i ] = ( byte ) val ;
168
- }
169
-
170
150
public static byte [ ] ? ReadByteBuffer ( this BinaryReader br , bool returnNull )
171
151
{
172
152
var len = br . ReadInt32 ( ) ;
@@ -308,7 +288,7 @@ static bool TryWaitForFileToVanish(string path)
308
288
309
289
/// <summary>creates span over <paramref name="length"/> octets starting at <paramref name="ptr"/></summary>
310
290
[ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
311
- public static Span < byte > UnsafeSpanFromPointer ( IntPtr ptr , int length )
291
+ public static unsafe Span < byte > UnsafeSpanFromPointer ( IntPtr ptr , int length )
312
292
{
313
293
return new ( pointer : ptr . ToPointer ( ) , length : length ) ;
314
294
}
@@ -319,7 +299,7 @@ public static Span<byte> UnsafeSpanFromPointer(IntPtr ptr, int length)
319
299
/// </summary>
320
300
/// <remarks>uses native endianness</remarks>
321
301
[ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
322
- public static Span < T > UnsafeSpanFromPointer < T > ( IntPtr ptr , int count )
302
+ public static unsafe Span < T > UnsafeSpanFromPointer < T > ( IntPtr ptr , int count )
323
303
where T : unmanaged
324
304
{
325
305
return new ( pointer : ptr . ToPointer ( ) , length : count * sizeof ( T ) ) ;
0 commit comments