BitfieldExtensions.cs 703 B

12345678910111213141516171819202122232425
  1. namespace Ryujinx.Graphics.Shader.Decoders
  2. {
  3. static class BitfieldExtensions
  4. {
  5. public static bool Extract(this int value, int lsb)
  6. {
  7. return ((int)(value >> lsb) & 1) != 0;
  8. }
  9. public static int Extract(this int value, int lsb, int length)
  10. {
  11. return (int)(value >> lsb) & (int)(uint.MaxValue >> (32 - length));
  12. }
  13. public static bool Extract(this long value, int lsb)
  14. {
  15. return ((int)(value >> lsb) & 1) != 0;
  16. }
  17. public static int Extract(this long value, int lsb, int length)
  18. {
  19. return (int)(value >> lsb) & (int)(uint.MaxValue >> (32 - length));
  20. }
  21. }
  22. }