Extract the upper and the lower half of an integer
Show older comments
Hi, is there a function that extract the upper half of an integer (most significants bits) and the lower half? Thanks
Answers (2)
per isakson
on 1 Jun 2012
0 votes
See: bitget
C = bitget(A, bit) returns the value of the bit at position bit in A.
Walter Roberson
on 1 Jun 2012
0 votes
For anything other than 8 bit integers, typecast() the integer into the unsigned integer type which is half of the size. You may have to deal with byte order problems, though.
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!