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

Projects
None yet
2 participants
@SquidDev
Contributor

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.

@dan200

This comment has been minimized.

Owner

dan200 commented Jun 28, 2017

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

@SquidDev

This comment has been minimized.

Contributor

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

Fix lua/bit32/bit-extract and lua/bit32/bit-replace not working on Co…
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment