title: Get Upper 4bits of a byte
body: <p>I am trying to get the upper 4 bits of a <code>Byte</code>.</p>
  
  <p>That is my attempt so far:</p>
  
  <pre><code>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;
  </code></pre>
  
  <p>Thanks In Advance.</p>