c# - Most efficient way to reverse the order of a BitArray? -
i've been wondering efficient way reverse order of bitarray in c#. clear, don't want inverse bitarray calling .not(), want reverse order of bits in array.
cheers, chris
public void reverse(bitarray array) { int length = array.length; int mid = (length / 2); (int = 0; < mid; i++) { bool bit = array[i]; array[i] = array[length - - 1]; array[length - - 1] = bit; } }
Comments
Post a Comment