Easy bit reversal
조회 수: 37 (최근 30일)
이전 댓글 표시
I need a function to reverse the bits of an int. I see I can flip bytes around, but that doesn't reverse the bit order. Any easy ideas? Thanks.
댓글 수: 0
채택된 답변
Walter Roberson
2012년 2월 22일
sum(uint32(bitset(0,1:32,bitget(uint32(X), 32:-1:1))))
(yes, there are other ways, some of them quite short but not necessarily efficient.)
댓글 수: 1
추가 답변 (2개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!