Extract the upper and the lower half of an integer
15 次查看(过去 30 天)
显示 更早的评论
Hi, is there a function that extract the upper half of an integer (most significants bits) and the lower half? Thanks
0 个评论
回答(2 个)
per isakson
2012-6-1
See: bitget
C = bitget(A, bit) returns the value of the bit at position bit in A.
0 个评论
Walter Roberson
2012-6-1
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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!