diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-01-20 04:13:30 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-01-20 04:13:30 +0100 |
commit | 83c1e5eecd96014fc6cfa1b8cf39d27ea2dde863 (patch) | |
tree | f35bb2fef351f0dba47f7363c236e5c8153ecdf8 /src/algorithms | |
parent | m (diff) | |
download | algorithms-and-data-structures-83c1e5eecd96014fc6cfa1b8cf39d27ea2dde863.tar.gz algorithms-and-data-structures-83c1e5eecd96014fc6cfa1b8cf39d27ea2dde863.tar.bz2 algorithms-and-data-structures-83c1e5eecd96014fc6cfa1b8cf39d27ea2dde863.tar.xz |
m
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/algorithms')
-rw-r--r-- | src/algorithms/bits/Bits.java | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/algorithms/bits/Bits.java b/src/algorithms/bits/Bits.java index b1719bc..0357199 100644 --- a/src/algorithms/bits/Bits.java +++ b/src/algorithms/bits/Bits.java @@ -132,10 +132,10 @@ public class Bits * @param value The integer * @return The number of set bits */ - public static £{T} ones_table(£{T} value) + public static byte ones_table(£{T} value) { -£>function lookup { echo "ONES_TABLE_256[(int)((value >> $1) & 255)]" ; } - return (£{T})((£{T})(£(lookup 0) + £(lookup 8)) + (£{T})(£(lookup 16) + £(lookup 24))); +£>function _ { echo "ONES_TABLE_256[(int)((value >> $1) & 255)]" ; } + return (byte)((byte)(£(_ 0) + £(_ 8)) + (byte)(£(_ 16) + £(_ 24))); /* In C you can split the value by getting the address of the value and cast the pointer to char* */ } £>done |