Skip to content

Instantly share code, notes, and snippets.

@Learath2
Created July 30, 2014 15:34
Show Gist options
  • Save Learath2/8b3c2d69e8f0735f17de to your computer and use it in GitHub Desktop.
Save Learath2/8b3c2d69e8f0735f17de to your computer and use it in GitHub Desktop.
K&R2 Exercise 2-6
/*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