Assets/Plugins/Unity.Media.Utilities/Runtime/Utility.cs
/// <summary>
/// Clears a portion of a buffer using a provided clear value
/// </summary>
/// <param name="buffer">The buffer to be cleared</param>
/// <param name="clearValue">The value to be set in each byte</param>
/// <param name="byteCount">The number of bytes to clear</param>
/// <remarks>
/// Equivalent to libc's memset()
/// </remarks>
Clears a portion of a buffer using a provided clear value
Clears a portion of a buffer using a provided clear value
public static unsafe void ClearBuffer(void* buffer, byte clearValue, long byteCount)
        {
#if UNITY_2019_3_OR_NEWER
            UnsafeUtility.MemSet(buffer, clearValue, byteCount);
#else
            var byteBuffer = (byte*)buffer;
            for (var i = 0; i < byteCount; ++i)
                byteBuffer[i] = clearValue;
#endif
        }
public static unsafe void ClearBuffer ( void * buffer , byte clearValue , long byteCount ) { if UNITY_2019_3_OR_NEWER UnsafeUtility . MemSet ( buffer , clearValue , byteCount ) ; else var byteBuffer = ( byte * ) buffer ; for ( var i = 0 ; i < byteCount ; ++ i ) byteBuffer [ i ] = clearValue ; endif }
Clears a portion of a buffer using a provided clear value
Clears a portion of a buffer using a provided clear value
buffer
void*
The buffer to be cleared
The buffer to be cleared
clearValue
byte
The value to be set in each byte
The value to be set in each byte
byteCount
long
The number of bytes to clear
The number of bytes to clear
remarks
Equivalent to libc's memset()
Equivalent to libc ' s memset ()