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

Source: Internet
Author: User

For the following value, write out the C-language expression for the variable x. The code should work for any word length w≥8. We give the results of the expressions when x=0x87654321 and w=32 are used for reference only.

The least significant byte of the a.x, and the other bits are 0. [0x00000021].

B. In addition to the least significant byte of x, all other bits are complementary and the least significant byte remains unchanged. [0x789abc21].

The minimum valid byte of the c.x is set to 1, and the other bytes remain unchanged. [0X876543FF].

Answer:

A. X & 0xFF

B. ~ (x ^ 0xFF) or (~x) ^ 0xFF

C. x | 0xFF

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

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.