for (counter = 0; u; u << = 1)
The compilation problem is here. You should be using operator <<= without spaces. If you put a space in-between, the compiler reads that as two separate operators: '<<' and '='.
You got a couple of other problems there as well, removing the space fixes the compilation.