Created
June 2, 2014 10:22
-
-
Save sriramster/ff6d8ac3b73ae884fdb8 to your computer and use it in GitHub Desktop.
Some msb bit extraction
This file contains hidden or 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
| #include <stdio.h> | |
| #define extract_msb(val, size) \ | |
| val >> ((size/2) * 4); \ | |
| int main() | |
| { | |
| int i = 0xffff; | |
| short j = extract_msb(i,4) | |
| printf("\n %d, %d", i, j); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment