fpc/tests/webtbs/tw5015.pp
Jonas Maebe 61522d00a2 * fixed tests now that i386 assembler code is checked for correct PIC
usage in case PIC generation is on (some by adding PIC-versions of
    the assembler code, most by adding -Cg- to the options to be used).

    Note: the Intel assembler reader does not yet support the Delphi
    PIC construct, so tests with that (like test/tasmread and test/tcg1)
    do not work with -Cg on non-Darwin (Darwin needs a different PIC
    construct)

git-svn-id: trunk@9370 -
2007-12-01 14:34:50 +00:00

43 lines
1.0 KiB
ObjectPascal

{ %cpu=i386 }
{ %OPT=-Cg- }
{ Source provided for Free Pascal Bug Report 5015 }
{ Submitted by "Zeljan Rikalo" on 2006-04-15 }
{ e-mail: zeljko@holobit.net }
program test;
{$mode delphi}
const
BitMaskTable: Array[0..31] of LongWord =
($00000001, $00000002, $00000004, $00000008,
$00000010, $00000020, $00000040, $00000080,
$00000100, $00000200, $00000400, $00000800,
$00001000, $00002000, $00004000, $00008000,
$00010000, $00020000, $00040000, $00080000,
$00100000, $00200000, $00400000, $00800000,
$01000000, $02000000, $04000000, $08000000,
$10000000, $20000000, $40000000, $80000000);
BitsPerByte = 8;
BitsPerWord = 16;
BitsPerLongWord = 32;
BytesPerCardinal = Sizeof(Cardinal);
BitsPerCardinal = BytesPerCardinal * 8;
function SetBit(const Value, BitIndex: LongWord): LongWord;
asm
{$IFOPT R+}
CMP BitIndex, BitsPerLongWord
JAE @Fin
{$ENDIF}
OR EAX, DWORD PTR [BitIndex * 4 + BitMaskTable]
@Fin:
end;
begin
end.