This repository has been archived on 2026-07-28. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
cmc/3sem/cnts/contest2/01.c
T
2025-04-13 21:48:15 +03:00

28 lines
509 B
C
Executable File

// #include <stdio.h>
typedef int STYPE;
typedef unsigned int UTYPE;
STYPE
bit_reverse(STYPE value)
{
UTYPE result = 0;
UTYPE uvalue = (UTYPE) value;
for (int i = 0; i < sizeof(STYPE) * 8; i++) {
result <<= 1;
result |= uvalue & 1;
uvalue >>= 1;
}
return (STYPE) result;
}
// int main(void) {
// STYPE value = 0b10101010;
// STYPE result = bit_reverse(value);
// printf("%d\n", result);
// printf("%ld\n", sizeof(STYPE));
// return 0;
// }