Initial work
This commit is contained in:
25
Ryujinx.Graphics.Shader/Decoders/BitfieldExtensions.cs
Normal file
25
Ryujinx.Graphics.Shader/Decoders/BitfieldExtensions.cs
Normal file
@ -0,0 +1,25 @@
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user