summaryrefslogtreecommitdiff
path: root/fpcsrc/tests/webtbs/tw4234.pp
blob: bb4c353298172c28a7471441edbf874325570f37 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
{ %opt=-O2 }

{$mode objfpc}

type
  TFPColor = record
    red,green,blue,alpha : word;
  end;
  TColorData = qword;

  tcl=class
    function ColorColorAlpha16 (CD:TColorData) : TFPColor;
  end;

function tcl.ColorColorAlpha16 (CD:TColorData) : TFPColor;
var c : qword;
begin
with result do
begin
red := CD and $FFFF;
c := qword($FFFF0000);
green := (CD and c) shr 16;
c := c shl 16;
blue := (CD and c) shr 32;
c := c shl 16;
alpha := (CD and c) shr 48;
end;
end;

var
  cd  : tcolordata;
  c : tcl;
begin
  cd:=$1234;
  c:=tcl.create;
  c.colorcoloralpha16(cd);
end.