chickadee » srfi-151 » bitwise-if

bitwise-if mask i jprocedure

Merge the bitstrings i and j, with bitstring mask determining from which string to take each bit. That is, if the kth bit of mask is 1, then the kth bit of the result is the kth bit of i, otherwise the kth bit of j.

    (bitwise-if 3 1 8) => 9
    (bitwise-if 3 8 1) => 0
    (bitwise-if 1 1 2) => 3
    (bitwise-if #b00111100 #b11110000 #b00001111) => #b00110011