mem0ri Posted February 6, 2008 Share Posted February 6, 2008 I've got a situation where...in the one case I'm setting a bitwise value $x: $x = (2 << $y); And another where I need to instead 'discover' the value of $y if $x is known instead... $y = 2 ???? $x; I could run a while loop.... while(($x/2) != 2) $z++; But I'm wondering if someone might know another, more 'efficient' way of working out the equation? It SEEMS like there must be an inverse relationship with << and >> that would allow you to figure how many bit's a number is shifted... BTW...I'm using only factorial values in this area of the app...so all numbers would come out as 'clean' numbers like 2, 4, 8, 16, 32, etc. Quote Link to comment https://forums.phpfreaks.com/topic/89811-simple-bitwise-questioni-hope/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.