Jump to content

Bit shifting in lua


Brutile
 Share

Recommended Posts

Looks easy to me... its already inherent to LE's current lua implementation as long as sandboxing is disabled.

This appears to be the list of available bitwise operations:

bit.tobit(x) -- normalize number to the numeric range of

bit.tohex(x[,n]) -- convert x to hex with n digits (default 8)

bit.bnot(x) -- bitwise not of x

bit.band(x1[,x2...]) -- bitwise and of x1, x2, ...

bit.bor(x1[,x2...]) -- bitwise or of x1, x2, ...

bit.bxor(x1[,x2...]) -- bitwise xor of x1, x2, ...

bit.lshift(x, n) -- left-shift of x by n bits

bit.rshift(x, n) -- logical right-shift of x by n bits

bit.arshift(x, n) -- arithmetic right-shift of x by n bits

bit.rol(x, n) -- left-rotate of x by n bits

bit.ror(x, n) -- right-rotate of x by n bits

bit.bswap(x) -- byte-swap of x (little-endian <-> big-endian)

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...