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