NVIDIA Interview Question: write a function to set a par... | Glassdoor

Interview Question

Systems Software Engineer Interview Santa Clarita, CA

write a function to set a particular field of register to

  the desired value. ( For example, set bit 3 - 10 of a word to the given value)
Tags:
c, bit manipulation
Answer

Interview Answer

2 Answers

0

Example:
Value=0x1234
Desired Bits are 0,1, 7 & 15
Desired value=0x8083

Value = value & (~DesireVal) on Dec 26, 2012
0

Example:
Value=0x1234
Desired Bits are 0,1, 7 & 15
Desired value=0x8083

Value = (value & (~DesireVal)) & DesiredVal on Dec 26, 2012

Add Answers or Comments

To comment on this, Sign In or Sign Up.