Bit manipulation: Difference between revisions

Content deleted Content added
Bit manipulation operations: add ref of binary and ternary logical operations
Tags: Mobile edit Mobile web edit Advanced mobile edit
Example of bit manipulation: add cross-ref examples in SWAR page
Tags: Mobile edit Mobile web edit Advanced mobile edit
 
Line 24:
 
== Example of bit manipulation ==
{{See also|SWAR#Examples}}
 
To determine if a number is a power of two, conceptually we may repeatedly do integer divide by two until the number won't divide by 2 evenly; if the only factor left is 1, the original number was a power of 2. Using bit and logical operators, there is a simple expression which will return true (1) or false (0):