aboutsummaryrefslogtreecommitdiffstats
path: root/src/algorithms/bits/Powers.java
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-01-20 04:04:12 +0100
committerMattias Andrée <maandree@operamail.com>2014-01-20 04:04:12 +0100
commit874371ea3a5ca7a4366cbe54bf8b0a77bf31894b (patch)
treef419e1786a1f931a7050a9f9fd84a4f5307baf7b /src/algorithms/bits/Powers.java
parentadd conditional negation (diff)
downloadalgorithms-and-data-structures-874371ea3a5ca7a4366cbe54bf8b0a77bf31894b.tar.gz
algorithms-and-data-structures-874371ea3a5ca7a4366cbe54bf8b0a77bf31894b.tar.bz2
algorithms-and-data-structures-874371ea3a5ca7a4366cbe54bf8b0a77bf31894b.tar.xz
m + counting bits
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--src/algorithms/bits/Powers.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/algorithms/bits/Powers.java b/src/algorithms/bits/Powers.java
index df6f926..84c9399 100644
--- a/src/algorithms/bits/Powers.java
+++ b/src/algorithms/bits/Powers.java
@@ -32,7 +32,7 @@ public class Powers
*/
public static boolean isPowerOf2(£{T} value)
{
- return (value & (value - 1)) == 0;
+ return (value & (value - 1)) == 0; /* The left hand side clears the least significant bit set */
/* Or alternatively: (value & -value) == value */
}
£>done