324_Book

# Representing and manipulating information expression

This preview shows page 1. Sign up to view the full content.

This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ate 1980s. Rather than instructions for Boolean operations A ND and O R, it had instructions bis (bit set) and bic (bit clear). Both instructions take a data word x and a mask word m. They generate a result z consisting of the bits of x modiﬁed according to the bits of m. With bis, the modiﬁcation involves setting z to 1 at each bit position where m is 1. With bic, the modiﬁcation involves setting z to 0 at each bit position where m is 1. We would like to write C functions bis and bic to compute the effect of these two instructions. Fill in the missing expressions in the code below using the bit-level operations of C. 2.1. INFORMATION STORAGE /* Bit Set */ int bis(int x, int m) { /* Write an expression in C that computes the effect of bit set */ int result = ___________; return result; } /* Bit Clear */ int bic(int x, int m) { /* Write an expression in C that computes the effect of bit set */ int result = ___________; return result; } 39 2.1.9 Logical Operations in C C also provi...
View Full Document

## This note was uploaded on 09/02/2010 for the course ELECTRICAL 360 taught by Professor Schultz during the Spring '10 term at BYU.

Ask a homework question - tutors are online