Posted by David Haynes on 05/21/06 15:00
Toby Inkster wrote: > bellefy@gmail.com wrote: > >> $r = ($v && ($v) == 0 ? true : false); > > Better: > > $r = (($v & ($v-1)) == 0); > > NEVER code '?true:false' (or the opposite). > This makes 0 a power of two... Try: $r = !($v & ($v-1)) && $v; -david-
[Reply to this message]
Copyright © 2005-2006 Powered by Custom PHP Programming