bitset and optimized array rotation