problem about cute patterns
when solving, bit operations are used, in which I know nothing. Is there a way to replace this code, which takes a long time through some kind of programmer (bit operations like &, <<, >>) method?
for(i=0;i<=m-2;i++){ string k1 = bitset<30>(p1).to_string(); reverse(k1.begin(), k1.end()); string k3 = bitset<30>(p2).to_string(); reverse(k3.begin(), k3.end()); b[1] = k1.at(i); b[2] = k1.at(i+1); b[3] = k3.at(i); b[4] = k3.at(i+1); if (b[1] == '1' && b[2] == '1' && b[3] =='1' && b[4] == '1'){ // квадрат в строках i и i + 1 чрный xx = false; } if ((b[1] == '0') &&(b[2] == '0') && (b[3] == '0') && (b[4] == '0')) { // квадрат в строках i и i + 1 белый xx = false; } } return xx; }