mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-12-21 00:16:50 +00:00
25 lines
703 B
C#
25 lines
703 B
C#
|
namespace Ryujinx.Graphics.Shader.Decoders
|
||
|
{
|
||
|
static class BitfieldExtensions
|
||
|
{
|
||
|
public static bool Extract(this int value, int lsb)
|
||
|
{
|
||
|
return ((int)(value >> lsb) & 1) != 0;
|
||
|
}
|
||
|
|
||
|
public static int Extract(this int value, int lsb, int length)
|
||
|
{
|
||
|
return (int)(value >> lsb) & (int)(uint.MaxValue >> (32 - length));
|
||
|
}
|
||
|
|
||
|
public static bool Extract(this long value, int lsb)
|
||
|
{
|
||
|
return ((int)(value >> lsb) & 1) != 0;
|
||
|
}
|
||
|
|
||
|
public static int Extract(this long value, int lsb, int length)
|
||
|
{
|
||
|
return (int)(value >> lsb) & (int)(uint.MaxValue >> (32 - length));
|
||
|
}
|
||
|
}
|
||
|
}
|