这是一段C的64位转32的代码函数,谁能帮我转成delphi的,最后得出ntohf即可。
  UINT32   ByteOrderConvertor::htonui(UINT32 value)
  {
       return (((value>>24)&0x000000ffU) | \
              ((value>>8)&0x0000ff00U) | \
              ((value<<8)&0x00ff0000U) | \
              ((value<<24)&0xff000000U));
  }  FLOAT32  ByteOrderConvertor::htonf(FLOAT32 value)
  {     
     UINT32 tmp=htonui(*((UINT32*)(&value)));
     return (*((float*)(&tmp)));
  }  FLOAT32  ByteOrderConvertor::ntohf(FLOAT32 value)
  {
     return htonf(value);
  }

解决方案 »

  1.   

    对方是这样给我说的,那你能不能帮偶译成DELPHI的呢?
      

  2.   

    function htonui(value: UINT): UINT;
    begin
      Result := (((value shr 24) and $000000ff) or
                ((value shr 8) and $0000ff00) or
                ((value shl 8) and $00ff0000) or
                ((value shl 24) and $ff000000));
    end;function htonf(value: Single): Single;
    var
      tmp: UINT;
    begin
      tmp := htonui(PUINT(@value)^);
      Result := PSingle(@tmp)^;
    end;function ntohf(value: Single): Single;
    begin
      Result := htonf(value);
    end;
    //可能是这样,如果你提供测试数据更好些