diff --git a/rtl/inc/generic.inc b/rtl/inc/generic.inc index 6d07e6e042..f61a6bb153 100644 --- a/rtl/inc/generic.inc +++ b/rtl/inc/generic.inc @@ -14,6 +14,24 @@ **********************************************************************} +function align(addr : PtrUInt;alignment : PtrUInt) : PtrUInt;{$ifdef SYSTEMINLINE}inline;{$endif} + var + tmp: PtrUInt; + begin + tmp:=addr+PtrUInt(alignment-1); + result:=tmp-(tmp mod alignment) + end; + + +{$ifndef cpujvm} +function align(addr : Pointer;alignment : PtrUInt) : Pointer;{$ifdef SYSTEMINLINE}inline;{$endif} + var + tmp: PtrUInt; + begin + tmp:=PtrUInt(addr)+(alignment-1); + result:=pointer(tmp-(tmp mod alignment)); + end; +{$endif} {**************************************************************************** Primitives @@ -21,7 +39,6 @@ type pstring = ^shortstring; - {$ifndef FPC_HAS_SHORTSTR_SHORTSTR_INTERN_CHARMOVE} {$define FPC_HAS_SHORTSTR_SHORTSTR_INTERN_CHARMOVE} procedure fpc_shortstr_shortstr_intern_charmove(const src: shortstring; const srcindex: byte; var dst: shortstring; const dstindex, len: byte); {$ifdef SYSTEMINLINE}inline;{$endif} @@ -2423,27 +2440,6 @@ procedure inclocked(var l:int64); {_$error Sptr must be defined for each processor } {$endif ndef FPC_SYSTEM_HAS_SPTR} - - -function align(addr : PtrUInt;alignment : PtrUInt) : PtrUInt;{$ifdef SYSTEMINLINE}inline;{$endif} - var - tmp: PtrUInt; - begin - tmp:=addr+PtrUInt(alignment-1); - result:=tmp-(tmp mod alignment) - end; - - -{$ifndef cpujvm} -function align(addr : Pointer;alignment : PtrUInt) : Pointer;{$ifdef SYSTEMINLINE}inline;{$endif} - var - tmp: PtrUInt; - begin - tmp:=PtrUInt(addr)+(alignment-1); - result:=pointer(tmp-(tmp mod alignment)); - end; -{$endif} - {**************************************************************************** Str() ****************************************************************************}