Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace BitAPI with a LuaJ implementation of bit32 #298

Open
wants to merge 2 commits into
base: master
from

Conversation

@SquidDev
Copy link
Contributor

@SquidDev SquidDev commented Jun 1, 2017

This removes CC's bit library and adds LuaJ's implementation of bit32, stubbing the original bit library. This has several advantages:

  • Performance: as CC's conversion code isn't used, the bit32 functions are significantly faster - my rather ad-hoc profiling shows a gain of somewhere between 1.5x and 2x.
  • Better "standard compliance": the LuaJ implementation of bit32 now accepts variadic arguments and implements extract and replace.

I realise you lose the nice abstraction of ILuaAPI, but I don't feel that is a great loss - bit won't be needed should we ever switch to Lua 5.2/5.3 anyway.

I'm happy to move this to the LuaJ directory and rebuild the LuaJ jar should you want.

@SquidDev SquidDev force-pushed the SquidDev-CC:feature/luaj-bit32 branch from bb804c9 to 084bbe8 Jun 17, 2017
@dan200
Copy link
Owner

@dan200 dan200 commented Jun 28, 2017

Idea seems good. How about moving this into our actual LuaJ sources?

@SquidDev
Copy link
Contributor Author

@SquidDev SquidDev commented Jun 28, 2017

Sure. Would you also like me to rebuild the LuaJ jar then?

SquidDev pushed a commit to SquidDev/urn that referenced this pull request Mar 31, 2018
…mputerCraft

ComputerCraft has an incomplete bit32 API.
bit32.lib.lua implemented ALL the functions in software, but only if bit32 didn't exist entirely, which does on CC.
This means bit32.extract and bit32.replace weren't implemented in software on CC. This commit fixes the issue.

See dan200/ComputerCraft#298
ccserver pushed a commit to ccserver/ComputerCraft that referenced this pull request Sep 16, 2019
…luaj-bit32

Replace BitAPI with a LuaJ implementation of bit32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.