Compare commits
4 commits
77b3f80ccc
...
afb500c7ca
| Author | SHA1 | Date | |
|---|---|---|---|
| afb500c7ca | |||
| 4950125379 | |||
| 13348109d1 | |||
| 558be63805 |
1 changed files with 3 additions and 2 deletions
5
c/ex3.c
5
c/ex3.c
|
|
@ -4,8 +4,9 @@
|
|||
static unsigned char reverse_byte(unsigned char c) {
|
||||
unsigned char res = 0;
|
||||
for (size_t i = 0; i < CHAR_BIT; ++i) {
|
||||
unsigned char bit = (c & (1 << i));
|
||||
res |= bit << (CHAR_BIT - i - 1);
|
||||
res <<= 1;
|
||||
res |= c & 1;
|
||||
c >>= 1;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue