mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-06 05:10:52 +02:00
m68k: small helpers to determine a given int value fits into a certain size or instruction argument
git-svn-id: trunk@29605 -
This commit is contained in:
parent
f0c5074e34
commit
9d6f763d4f
@ -360,6 +360,10 @@ unit cpubase;
|
||||
function conditions_equal(const c1, c2: TAsmCond): boolean; {$ifdef USEINLINE}inline;{$endif USEINLINE}
|
||||
function dwarf_reg(r:tregister):shortint;
|
||||
|
||||
function isvalue8bit(val: tcgint): boolean;
|
||||
function isvalue16bit(val: tcgint): boolean;
|
||||
function isvalueforaddqsubq(val: tcgint): boolean;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
@ -542,4 +546,23 @@ implementation
|
||||
internalerror(200603251);
|
||||
end;
|
||||
|
||||
|
||||
{ returns true if given value fits to an 8bit signed integer }
|
||||
function isvalue8bit(val: tcgint): boolean;
|
||||
begin
|
||||
isvalue8bit := (val >= low(shortint)) and (val <= high(shortint));
|
||||
end;
|
||||
|
||||
{ returns true if given value fits to a 16bit signed integer }
|
||||
function isvalue16bit(val: tcgint): boolean;
|
||||
begin
|
||||
isvalue16bit := (val >= low(smallint)) and (val <= high(smallint));
|
||||
end;
|
||||
|
||||
{ returns true if given value fits addq/subq argument, so in 1 - 8 range }
|
||||
function isvalueforaddqsubq(val: tcgint): boolean;
|
||||
begin
|
||||
isvalueforaddqsubq := (val >= 1) and (val <= 8);
|
||||
end;
|
||||
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user