delphi中有比较简洁的方式把一个字节的8位高低倒过来吗?比如  03H   八位为  00000011  我想要得出对应的  11000000   即 D0H

解决方案 »

  1.   

    outByte:=(inByte shr 7) or ((inByte and $40) shr 5) or ((inByte and $20) shr 3) or ((inByte and $10) shr 1) or ((inByte and $01) shl 7) or ((inByte and $02) shl 5) or ((inByte and $04) shl 3) or ((inByte and $08) shl 1)
      

  2.   

    http://blog.vckbase.com/panic/archive/2005/06/11/6389.html?
      

  3.   

    var
      n : Byte;
    begin
      n := $23;
      n := (n shl 4) or (n shr 4);
      

  4.   


    delphi中有比较简洁的方式把一个字节的8位高低倒过来吗? 比如     03H       八位为     00000011     我想要得出对应的     11000000       即   D0H
    ----------
    就倒转字符使用
    uses
    StrUtils
    ReverseString(string);
      

  5.   

    ReverseString(string)对于一个8位或者16为的数字不行吧,还是采取楼上的方法,这基本跟语言无关了,哪个语言都是这几种办法