[fpc-devel] ROL/ROR with Carry
Sven Barth
pascaldragon at googlemail.com
Mon Jan 11 19:10:20 CET 2021
Hello together!
Considering that jamie philbrook has given up on his feature request (
https://bugs.freepascal.org/view.php?id=38341 ) rather quickly and that
it had been my idea for him to open that bug report I'd like to discuss
this here.
So the idea is to add support for ROL/ROR with Carry support as the
current Rol*/Ror* functions don't support that. Florian then said that
he's open to suggestions under some restrictions. Considering that the
current Rol*/Ror* intrinsics aren't available for all platforms as
intrinsics either, but as functions then, this could be done to support
CPUs without suitable Carry support as well. And the code snippet that
jamie showed would be a nice base:
=== code begin ===
Function ROLByteWithCarry(Const AByte:Byte; Var ACarry:Boolean):Byte;Inline;
var
LocalIn:Boolean;
Begin
LocalIN := Acarry;
ACarry := ShortInt(Abyte) < 0;
Result := (AByte shl 1);
IF LocalIn then Result := Result or 1;
End;
=== code end ===
Am I missing something?
Regards,
Sven
More information about the fpc-devel
mailing list