From 83c1e5eecd96014fc6cfa1b8cf39d27ea2dde863 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Mon, 20 Jan 2014 04:13:30 +0100 Subject: m MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/algorithms/bits/Bits.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/algorithms') 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 -- cgit v1.2.3-70-g09d2