In-depth understanding of computer system second edition Exercise answers CSAPP 2.13, csapp2.13

Source: Internet
Author: User

In-depth understanding of computer system second edition Exercise answers CSAPP 2.13, csapp2.13

From the end of 1970s to the end of 1980s, Digital Equipment's VAX computer was a very popular model. It does not have Boolean operations and or commands, but only bis (bit setting) AND bic (bit clearing) commands. The input of the two commands is a data word x and a mask word m. They generate a result z, which is obtained by modifying the x bit based on the mask m bit. Using the bis command, this modification is to set the z bit to 1 at every position where m is 1. Using the bic command, this modification is to set the z bit to 0 at every position where m is 1.

Only these two functions are used to implement the bitwise | and ^ operations in the C language.

1 int bis (int x, int m); 2 int bic (int x, int m); 3 4 int bool_or (int x, int y) 5 {6 int result = bis (x, y); 7 return result; 8} 9 10 int bool_xor (int x, int y) 11 {12 int result = bis (bic (x, y), bic (y, x); 13 return result; 14}

 

Related Article

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.