mirror of
https://github.com/ahwootech/BRUTAL.git
synced 2026-11-26 04:58:24 +01:00
SOURCE DUMP v1
This commit is contained in:
parent
bd62d51ec9
commit
fb20299e9d
1 changed files with 768360 additions and 0 deletions
25
brutal.imgui/Brutal.ImGui/ImString/InteropExtensions.cs
Normal file
25
brutal.imgui/Brutal.ImGui/ImString/InteropExtensions.cs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Brutal.ImGuiApi;
|
||||
|
||||
static class InteropExtensions
|
||||
{
|
||||
/// Whether this span is unset rather than empty.
|
||||
/// Technically "IsDefault", but "IsNull" seems more intuitive.
|
||||
public static unsafe bool IsNull<T>(in this ReadOnlySpan<T> span)
|
||||
where T : unmanaged
|
||||
{
|
||||
ref var spanRef = ref MemoryMarshal.GetReference(span);
|
||||
fixed (T* spanPtr = &spanRef)
|
||||
return spanPtr == null;
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IsNull{T}(in System.ReadOnlySpan{T})"/>
|
||||
public static unsafe bool IsNull<T>(in this Span<T> span)
|
||||
where T : unmanaged
|
||||
{
|
||||
ref var spanRef = ref MemoryMarshal.GetReference(span);
|
||||
fixed (T* spanPtr = &spanRef)
|
||||
return spanPtr == null;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue