Replace byte1 and byte2 in my example with
dataArray[0] and dataArray[1]
element represent the 8 bits that go to a shift register.
Some manipulation examples:
clear bit 3:
dataArray[0] = dataArray[0] & 0b11110111;
set bit 5:
dataArray[0] = dataArray[0] | 0b00100000;
Then transfer the data out as shown.