Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I am not really sure what this question is even asking, if I could get some help

ID: 3863477 • Letter: I

Question

I am not really sure what this question is even asking, if I could get some help reading the forumlas and making sense of the "help" the assignment gives it would be appericated.

Question:

Write C expressions to generate the bit patterns that follow, where ak represents k repetitions of symbol a. Assume a w-bit data type. Your code may contain references to parameters j and k, representing the values of j and k, but not a parameter representing w. Using constants such as INT_MIN and INT_MAX is not allowed since it is an indirect reference to the value of w.

Bit Pattern A. 1wk0k

Bit Pattern B. 0wkj1k0j

Your C expressions should be programmed in .c file with sample tests.

Your expression should follow the bit-level integer coding rules. This means solutions including loops are not valid.

"Help" given:

For bit pattern 1w , the answer is printf(“%x ”, -1);

bit-level integer coding rules:

Assumptions

Integers are represented in two’s-complement form.

Right shifts of signed data are performed arithmetically.

Data type int is w bits long. For some of the problems, you will be given a specific value for , but otherwise your code should work as long as is a multiple of 8. You can use the expression to compute .

Forbidden

Conditionals (if or ?:), loops, switch statements, function calls, and macro invocations.

Division, modulus, and multiplication.

Relative comparison operators (<, >, <=, and >=).

Casting, either explicit or implicit.

Allowed operations

All bit-level and logic operations.

Addition and subtraction.

Equality (==) and inequality (!=) tests. (Some of the problems do not allow

these.)

Integer constants INT_MIN and INT_MAX.

Explanation / Answer

Shift operator will be like for the above thing is

unsigned lmn(unsigned a, int b)
{

/*arithmetically shift */
unsigned xijk = (int) a >> b;

/* ... */

}

int ijk(int a, int k)
{

/* logically shift */
int xlmn = (unsigned) a >> b;

Please let us know if it helps.