In-depth understanding of computer system Second Edition exercise solution Csapp 2.13

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.