refactoring DtStatus 1st

This commit is contained in:
ikpil 2023-06-10 13:27:27 +09:00
parent a10dae89cd
commit 7bca7922eb
2 changed files with 26 additions and 25 deletions

View File

@ -18,6 +18,8 @@ freely, subject to the following restrictions:
3. This notice may not be removed or altered from any source distribution. 3. This notice may not be removed or altered from any source distribution.
*/ */
using System.Runtime.CompilerServices;
namespace DotRecast.Detour namespace DotRecast.Detour
{ {
public class DtStatus public class DtStatus
@ -45,5 +47,29 @@ namespace DotRecast.Detour
{ {
Value = value; Value = value;
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool IsSuccess()
{
return 0 != (Value & (DT_SUCCSESS.Value | DT_PARTIAL_RESULT.Value));
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool IsFailed()
{
return 0 != (Value & (DT_FAILURE.Value | DT_INVALID_PARAM.Value));
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool IsInProgress()
{
return 0 != (Value & DT_IN_PROGRESS.Value);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool IsPartial()
{
return 0 != (Value & DT_PARTIAL_RESULT.Value);
}
} }
} }

View File

@ -1,25 +0,0 @@
namespace DotRecast.Detour
{
public static class DtStatusExtension
{
public static bool IsSuccess(this DtStatus @this)
{
return @this == DtStatus.DT_SUCCSESS || @this == DtStatus.DT_PARTIAL_RESULT;
}
public static bool IsFailed(this DtStatus @this)
{
return @this == DtStatus.DT_FAILURE || @this == DtStatus.DT_INVALID_PARAM;
}
public static bool IsInProgress(this DtStatus @this)
{
return @this == DtStatus.DT_IN_PROGRESS;
}
public static bool IsPartial(this DtStatus @this)
{
return @this == DtStatus.DT_PARTIAL_RESULT;
}
}
}