Unstable v0.15.17.0 (Hex is out of town edition)

This commit is contained in:
Juan Pablo Arce
2021-12-03 13:31:10 -03:00
parent cd5c8f3e13
commit 617d9ede88
245 changed files with 8088 additions and 5842 deletions
@@ -9,6 +9,7 @@ using System.Linq;
using System.Reflection;
using System.Security.Cryptography;
using System.Text;
using System.Runtime.CompilerServices;
namespace Barotrauma
{
@@ -534,6 +535,16 @@ namespace Barotrauma
}
}
// Enum.HasFlag() sucks
public static bool IsBitSet<T>(this T self, T bit) where T : struct, Enum
{
// This uses Unsafe.As for performance reasons, as
// C# will otherwise not allow a T -> int cast
// without first casting to object, which would make
// this not any better than Enum.HasFlag
return (Unsafe.As<T, int>(ref self) & Unsafe.As<T, int>(ref bit)) != 0;
}
public static string ByteArrayToString(byte[] ba)
{
StringBuilder hex = new StringBuilder(ba.Length * 2);