mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-22 00:09:25 +02:00
Revert " * patch by Rika: SwapEndian([u]int16) has unnecessary “and $FFFF”, resolves #39814"
This reverts commit f92102a5f2
.
The and $ffff is needed to avoid range check warnings when the function is inlined with a constant parameter
This commit is contained in:
parent
8d90cd3e64
commit
799c22d553
@ -2667,13 +2667,13 @@ function SwapEndian(const AValue: SmallInt): SmallInt;{$ifdef SYSTEMINLINE}inlin
|
||||
{ is turned into "longint(AValue) shr 8", so if AValue < 0 then }
|
||||
{ the sign bits from the upper 16 bits are shifted in rather than }
|
||||
{ zeroes. }
|
||||
Result := SmallInt((Word(AValue) shr 8) or (Word(AValue) shl 8));
|
||||
Result := SmallInt(((Word(AValue) shr 8) or (Word(AValue) shl 8)) and $ffff);
|
||||
end;
|
||||
|
||||
{$ifndef cpujvm}
|
||||
function SwapEndian(const AValue: Word): Word;{$ifdef SYSTEMINLINE}inline;{$endif}
|
||||
begin
|
||||
Result := (AValue shr 8) or (AValue shl 8);
|
||||
Result := ((AValue shr 8) or (AValue shl 8)) and $ffff;
|
||||
end;
|
||||
{$endif}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user