From the late 1970s to the late 80, Digital Equipment's VAX computer was a very popular model. It does not have Boolean operations and and or directives, only bis (bit set) and BIC (bit clear) directives. The input of both instructions is a data word X and a mask word m. They generate a result z,z is obtained by modifying the bits of x based on the bits of the mask m. With the BIS directive, this modification is to set the z-corresponding bit to 1 for each position where M is 1. With the BIC directive, this modification is to set the z-corresponding bit to 0 at each location where M is 1.
Use only these two functions to implement the bitwise | and ^ operations of the C language.
1 intbisintXintm);2 intBicintXintm);3 4 intBool_or (intXinty)5 {6 intresult = bis (x, y);7 returnresult;8 }9 Ten intBool_xor (intXinty) One { A intresult = bis (BIC (x, y), Bic (y, x)); - returnresult; -}
In-depth understanding of computer system Second Edition exercise solution Csapp 2.13