let cand x y arr =
let bit_and ctr tar = if (ctr == 1 && tar == 1) then 1 else 0 in
arr.(y) <- bit_and arr.(x) arr.(y);
arr
let cor x y arr =
let bit_or ctr tar = if (ctr == 0 && tar == 0) then 0 else 1 in
arr.(y) <- bit_or arr.(x) arr.(y);
arr
let xor x y arr =
let bit_xor ctr tar = if (ctr == tar) then 0 else 1 in
arr.(y) <- bit_xor arr.(x) arr.(y);
arr
Not sure if this was intent, but usually isn't:
==
is pointer quality , you probably wanted=