git.samba.org
/
metze
/
misc
/
junkcode.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
shift: add example about tricky bit shifting
[metze/misc/junkcode.git]
/
shift
/
shift.c
1
#include <stdint.h>
2
#include <stdio.h>
3
#include <assert.h>
4
5
int main(void)
6
{
7
int32_t v;
8
uint32_t u32;
9
10
v = 0xe2340001;
11
12
u32 = (v >> 16);
13
14
printf(" v[0x%08X] u32[%08X]\n", v, u32);
15
assert(u32 == 0xFFFFe234);
16
17
v = 0x12340001;
18
19
u32 = (v >> 16);
20
21
printf(" v[0x%08X] u32[%08X]\n", v, u32);
22
assert(u32 == 0x00001234);
23
24
return 0;
25
}