+ added sqr(shortint) and sqr(smallint) for CPUs with 8/16-bit alu

git-svn-id: trunk@36342 -
This commit is contained in:
nickysn 2017-05-26 13:16:36 +00:00
parent 7c9e5591b6
commit ba665e103c
2 changed files with 24 additions and 0 deletions

View File

@ -1993,6 +1993,24 @@ end;
{$endif ndef FPC_SYSTEM_HAS_ODD_QWORD}
{$if defined(CPUINT8)}
{$ifndef FPC_SYSTEM_HAS_SQR_SHORTINT}
function sqr(l:shortint):shortint;{$ifdef SYSTEMINLINE}inline;{$endif}
begin
sqr:=l*l;
end;
{$endif ndef FPC_SYSTEM_HAS_SQR_SHORTINT}
{$endif CPUINT8}
{$if defined(CPUINT16) or defined(CPUINT8)}
{$ifndef FPC_SYSTEM_HAS_SQR_SMALLINT}
function sqr(l:smallint):smallint;{$ifdef SYSTEMINLINE}inline;{$endif}
begin
sqr:=l*l;
end;
{$endif ndef FPC_SYSTEM_HAS_SQR_SMALLINT}
{$endif CPUINT16 or CPUINT8}
{$ifndef FPC_SYSTEM_HAS_SQR_LONGINT}
function sqr(l:longint):longint;{$ifdef SYSTEMINLINE}inline;{$endif}

View File

@ -875,6 +875,12 @@ Function abs(l:Int64):Int64;[internproc:fpc_in_abs_long];
{$else FPC_HAS_INTERNAL_ABS_INT64}
Function abs(l:Int64):Int64;[internconst:fpc_in_const_abs];{$ifdef SYSTEMINLINE}inline;{$endif}
{$endif FPC_HAS_INTERNAL_ABS_INT64}
{$if defined(CPUINT8)}
Function sqr(l:shortint):shortint;[internconst:fpc_in_const_sqr];{$ifdef SYSTEMINLINE}inline;{$endif}
{$endif CPUINT8}
{$if defined(CPUINT16) or defined(CPUINT8)}
Function sqr(l:smallint):smallint;[internconst:fpc_in_const_sqr];{$ifdef SYSTEMINLINE}inline;{$endif}
{$endif CPUINT16 or CPUINT8}
Function sqr(l:Longint):Longint;[internconst:fpc_in_const_sqr];{$ifdef SYSTEMINLINE}inline;{$endif}
Function sqr(l:Int64):Int64;[internconst:fpc_in_const_sqr];{$ifdef SYSTEMINLINE}inline;{$endif}
Function sqr(l:QWord):QWord;[internconst:fpc_in_const_sqr];{$ifdef SYSTEMINLINE}inline;{$endif}