ScratchData LogoScratchData
Back to njdavison_test's profile

isPowerofTwo | Bitwise operator performance test

NJnjdavison_test•Created November 12, 2021
isPowerofTwo | Bitwise operator performance test
0
0
8 views
View on Scratch

Instructions

Bitwise operator performance test We can test if a number is a power of 2 in 2 ways: mod(log2(n),1)==0 AND(n,n-1)==0 This project compares the performance of log2 vs bitwise operators. On a real CPU AND register the bitwise operator would be much faster.

Project Details

Project ID600251041
CreatedNovember 12, 2021
Last ModifiedNovember 12, 2021
SharedNovember 12, 2021
Visibilityvisible
CommentsAllowed