⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 interlockedhelper.cs

📁 破解的飞信源代码
💻 CS
字号:
namespace NCindy.Util
{
    using System;
    using System.Runtime.InteropServices;
    using System.Threading;

    public static class InterlockedHelper
    {
        public static int And(ref int target, int with)
        {
            int comparand;
            int num2 = target;
            do
            {
                comparand = num2;
                num2 = Interlocked.CompareExchange(ref target, comparand & with, comparand);
            }
            while (comparand != num2);
            return num2;
        }

        public static bool CompareAndExchange(ref int value, int ifThisEqualsToValue, int thenExchangeValueWithThis)
        {
            return (Interlocked.CompareExchange(ref value, thenExchangeValueWithThis, ifThisEqualsToValue) == ifThisEqualsToValue);
        }

        public static bool CompareAndExchange(ref int value, int ifThisEqualsToValue, int thenExchangeValueWithThis, out int originalValue)
        {
            originalValue = Interlocked.CompareExchange(ref value, thenExchangeValueWithThis, ifThisEqualsToValue);
            return (originalValue == ifThisEqualsToValue);
        }

        public static int Or(ref int target, int with)
        {
            int comparand;
            int num2 = target;
            do
            {
                comparand = num2;
                num2 = Interlocked.CompareExchange(ref target, comparand | with, comparand);
            }
            while (comparand != num2);
            return num2;
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -