An "if (test & (1<<i))" ist absolut überhaupt nichts dirty.