KO CSharp Operator Bitwise - LIHACHTETAN/ClassicUO-Bad-Newbie-CSharp-Scripts-IDE GitHub Wiki

ะฃะบั€ะฐั—ะฝััŒะบะฐ ยท ะ ัƒััะบะธะน ยท English ยท Deutsch ยท Franรงais ยท Italiano ยท Espaรฑol ยท ็น้ซ”ไธญๆ–‡ ยท ๆ—ฅๆœฌ่ชž ยท ํ•œ๊ตญ์–ด

๋น„ํŠธ์™€ ์‚ฐ์‚ฌํƒœ

ํ•ธ๋“œ๋ถ C# ยท ์‹ค์šฉ ๊ฐ€์ด๋“œ

์ •์ˆ˜ ๋น„ํŠธ๋ฅผ ์ฒ˜๋ฆฌํ•ฉ๋‹ˆ๋‹ค. >> ์„œ๋ช…๋œ ๊ฒฝ์šฐ ๊ฐ’์€ ๋ถ€ํ˜ธ๋ฅผ ์ €์žฅํ•ฉ๋‹ˆ๋‹ค. >>> ๋ถ€ํ˜ธ ์—†๋Š” ์ œ๋กœ ํŒจ๋”ฉ ์‹œํ”„ํŠธ๋ฅผ ์ˆ˜ํ–‰ํ•ฉ๋‹ˆ๋‹ค.

๊ฐ„๋‹จํ•œ ์˜ˆ์ œ (Example.cs)

์ด ์˜ˆ์ œ๋ฅผ Example.cs๋กœ ๋”ฐ๋กœ ์ €์žฅํ•˜๊ณ  ์ด ํŽ˜์ด์ง€์˜ ๋‹ค๋ฅธ ์˜ˆ์ œ์™€ ๋…๋ฆฝ์ ์œผ๋กœ ์‹คํ–‰ํ•˜์„ธ์š”.

Example.cs:

// PROJECT-EXAMPLE
int flags = 1 | 2;
System.Console.WriteLine(flags & 2);

๊ฒฐ๊ณผ:

2

ํ†ต์‚ฌ๋ก 

mask & flag / value << count / value >>> count

์˜ˆ์‹œ 1

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.IO;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;

public static class Program
{
    public static async Task Main(string[] args)
    {
        int flags = 0b0101;
        Console.WriteLine($"{flags & 0b0011}:{flags | 0b0010}:{flags ^ 0b0001}:{~flags}");
    }
}

์˜ˆ์‹œ 2

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.IO;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;

public static class Program
{
    public static async Task Main(string[] args)
    {
        int value = -8;
        Console.WriteLine($"{value << 1}:{value >> 1}:{value >>> 1}");
    }
}

๊ณต์‹ ์ถœ์ฒ˜: Microsoft ํ•™์Šต.