aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Shader/Decoders/BitfieldExtensions.cs
blob: 79e0a5c0e9b78dcd44a6d1858df08c34ccac32de (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
namespace Ryujinx.Graphics.Shader.Decoders
{
    static class BitfieldExtensions
    {
        public static bool Extract(this int value, int lsb)
        {
            return ((value >> lsb) & 1) != 0;
        }

        public static int Extract(this int value, int lsb, int length)
        {
            return (value >> lsb) & (int)(uint.MaxValue >> (32 - length));
        }
    }
}