LaTeX format for LuaMetaTeX
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
431 B

2 years ago
2 years ago
  1. local mask32 = 0xFFFFFFFF
  2. return {
  3. rshift = function(i, s)
  4. return (mask32 & i) >> s
  5. end,
  6. lshift = function(i, s)
  7. return mask32 & (i << s)
  8. end,
  9. band = function(i, j)
  10. return i & j & mask32
  11. end,
  12. bor = function(i, j)
  13. return (i | j) & mask32
  14. end,
  15. bor = function(i, j)
  16. return (i ^ j) & mask32
  17. end,
  18. extract = function(v, shift, count)
  19. return ((mask32 & v) >> shift) & ((1<<count)-1)
  20. end,
  21. }