www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Generate crc lookup table Dlang style

While solving a unrelated programming problem I ended up copying
a CRC16-CCITT implementation Google found for me. After I thought
it would be nice to make a D style implementation with some
compile time magic.
My idea was to implement something similar to:
generating the CRC lookup table compile time.

Now. For me it seems like this it should be possible to be
accomplished with the following function definition:
T[] generate_crc_table(T)(T polynomial, T initialValue, bool
Here is a Gist with my attempt:

Where does crchighbit come from, I'm missing something?
Could there possibly be a D programmer somewhere out there with
the expertise to help me?
Jan 26 2014