SAR intrinsic overloads
Original Reporter info from Mantis: runewalsh
-
Reporter name:
Original Reporter info from Mantis: runewalsh
- Reporter name:
Description:
SAR intrinsics (SarLongint, SarInt64, ...) are much like a workaround for SHR not performing arithmetic shift for signed types, so I think it will be convenient to have plain ‘Sar’ overloads on top of them, as their effect doesn't depend on type, unlike, say, ROL/ROR, and the SHR operator to which they are similar is also „overloaded“ for all types.
Additional information:
For me, I just redefined
function Sar(const value: int8): int8; [internproc: fpc_in_sar_x];
function Sar(const value: int8; shift: byte): int8; [internproc: fpc_in_sar_x_y];
function Sar(const value: int16): int16; [internproc: fpc_in_sar_x];
function Sar(const value: int16; shift: byte): int16; [internproc: fpc_in_sar_x_y];
function Sar(const value: int32): int32; [internproc: fpc_in_sar_x];
function Sar(const value: int32; shift: byte): int32; [internproc: fpc_in_sar_x_y];
function Sar(const value: int64): int64; [internproc: fpc_in_sar_x];
function Sar(const value: int64; shift: byte): int64; [internproc: fpc_in_sar_x_y];
and it seems to be working.
Mantis conversion info:
- Mantis ID: 37755
- Monitored by: » @CuriousKit (J. Gareth Moreton)