-1

我正在尝试获取 a 的高 4 位Byte

到目前为止,这是我的尝试:

function Upper4Bits(const X : Byte): Byte;
type 
   BS = set of 0..7;
var 
   K : Byte; Q: BS;
begin
  Q := [];
  for K := 0 to 3 do {is it right? upper?}
    {what i need here?}
    Include(Q, {what i put here});

  Upper4Bits := Byte(Q)
end;

提前致谢。

4

3 回答 3

8

根据您对 kotlinski 回答的评论,您想要result := (byte1 and $F0) or (byte3 and $0F).

于 2011-06-26T12:01:16.263 回答
6

在此处输入图像描述

于 2011-06-26T12:32:50.443 回答
3

怎么样Upper4Bits := X Shr 4;

于 2011-06-26T11:26:20.523 回答