I have two questions that I am trying to solve:
Assuming the same 4-bit computer with signed representation, give a C expression that computes the requested:
Given a number 'n', compute a word with the lower 'n' bits set to '1'. You don't know 'n' in advance.
Given a number 'n', compute a word with the higher 'n' bits set to '1'. You don't know 'n' in advance.
I think that this is a question on masking, and I am totally new to bit operations (and to C altogether). Our book gives one whole paragraph to the topic of masking, and our instructor glossed over it so fast that if you coughed, you missed it. I've been searching all over the place to figure this out. Basically, I am totally clueless.
Can somebody help me with this? I don't know where to look for information or even how to start.
Thanks a lot! Sorry to be so dense.