안녕하세요
[0 1 2 3 4 5 6 7] -> [7 6 5 4 3 2 1 0] 이렇게요
bit 구조체를 사용해볼까 했는데 순 노가다 같아서요
손쉬운 방법 알고 계시면 조언 부탁드리겠습니다.
즐건 하루 되십시요
http://graphics.stanford.edu/~seander/bithacks.html#BitReverseObvious
다음 책에 알고리듬이 소개되어 있습니다. (Reversing Bits and Bytes) Henry S. Warren, Jr., Hacker's Delight, Addison-Wesley, 2003
unsigned rev(unsigned x) { x = (x & 0x55555555) << 1 | (x >> 1) & 0x55555555; x = (x & 0x33333333) << 2 | (x >> 2) & 0x33333333; x = (x & 0x0F0F0F0F) << 4 | (x >> 4) & 0x0F0F0F0F; x = (x << 24) | ((x & 0xFF00) << 8) | ((x >> 8) & 0xFF00) | (x >> 24); return x; }
진정 고수 십니다. ^^;
용모수려 재색겸비
http://graphics.stanford.edu/
http://graphics.stanford.edu/~seander/bithacks.html#BitReverseObvious
다음 책에
다음 책에 알고리듬이 소개되어 있습니다. (Reversing Bits and Bytes)
Henry S. Warren, Jr., Hacker's Delight, Addison-Wesley, 2003
unsigned rev(unsigned x) { x = (x & 0x55555555) << 1 | (x >> 1) & 0x55555555; x = (x & 0x33333333) << 2 | (x >> 2) & 0x33333333; x = (x & 0x0F0F0F0F) << 4 | (x >> 4) & 0x0F0F0F0F; x = (x << 24) | ((x & 0xFF00) << 8) | ((x >> 8) & 0xFF00) | (x >> 24); return x; }감사합니다. ^^;
진정 고수 십니다. ^^;
용모수려 재색겸비
용모수려 재색겸비