ScratchData LogoScratchData
Back to DCPU-16's profile

Fast 8 bit bitwise operations using a Cartesian Product map

DCDCPU-16•Created October 9, 2014
Fast 8 bit bitwise operations using a Cartesian Product map
13
8
496 views
View on Scratch

Description

Much faster than manual calculation - though space quickly becomes a concern as when the project is saved the number lists are stringified to store in the JSON. The solution to this is to delete the lists before saving the project and regenerate them on startup - however this takes about 8 seconds on my system for just AND and OR. XOR is also possible this way. Since this only works for 8 bit numbers (16 bit would take up more memory than anyone has) it's only really useful for an 8 bit system emulator. It might find a use in my gameboy emulator when I choose to improve it. Bitshifts aren't included because they're not the point - they can be easily calculated using the ShiftMul array. (a >> b) == (a*ShiftMul[b+1])

Project Details

Project ID29146480
CreatedOctober 9, 2014
Last ModifiedNovember 13, 2014
SharedOctober 9, 2014
Visibilityvisible
CommentsAllowed