Created
July 30, 2014 15:34
-
-
Save Learath2/8b3c2d69e8f0735f17de to your computer and use it in GitHub Desktop.
K&R2 Exercise 2-6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*K&R2 Exercise 2-6 "setbits"*/ | |
#include <stdio.h> | |
unsigned setbits(unsigned, int, int, unsigned); | |
int main() | |
{ | |
} | |
unsigned setbits(unsigned x, int p, int n, unsigned y) | |
{ | |
return x | y & ~(~0 << n) << (p - n + 1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment