我从图像文件读出一个字节,现在想分析这个字节中的各个比特,请问如何读取出来?例如我读出来的一个字节是f7,那么就应该是11110111。我想先取前三个比特,赋给一个整形的变量,那么这个变量的值就应该为7。请问如何实现?
解决方案 »
- delphi 如何做一个转盘抽奖的程序??
- 如何使用checkbox控件数组
- clientsocket 不停的连接掉线的服务端,会提示10055和内在不够用的错误提示
- ****请帮忙解释是什么意思!!!!!!******
- 写了一个ntservice的服务 不能启动外部程序 加急!!100分
- MessageBox()在数据模块中不能通过.
- 重回csdn散分!!!
- Delphi编写的DLL如何进行测试?调试??(急。。。)
- 如果用adoquery,来管理dbedit,还应配哪几个控件?
- 帮忙看看这段程序。
- 求助,给动态添加的控件添加事件处理的问题
- 如何在客户端处即时显示刚添加的数据?其中数据在应用程序服务器上添加,超急!
var
a:Word;
b:integer;
begin
a := $F7;
b := a shr 5;
caption := intToStr(b);
end;
帮助上有详细说明
he operations x shl y and x shr y shift the value of x to the left or right by y bits, which (if x is an unsigned integer) is equivalent to multiplying or dividing x by 2^y; the result is of the same type as x. For example, if N stores the value 01101 (decimal 13), then N shl 1 returns 11010 (decimal 26). Note that the value of y is interpreted modulo the size of the type of x. Thus for example, if x is an integer, x shl 40 is interpreted as x shl 8 because an integer is 32 bits and 40 mod 32 is 8.