[fpc-pascal] rotating bits
XHajT03 at mbox.vol.cz
Wed May 24 15:26:58 CEST 2006
đŁÔŇ ëĎÓÁŇĹ×ÓËÉĘ wrote:
>> On 24 mei 2006, at 10:56, đŁÔŇ ëĎÓÁŇĹ×ÓËÉĘ wrote:
>> > Is there high level operator/(inline)function for rotating bits?
>> > Am I supposed to implement rotating bits (like ror/rol in i386 asm)
>> > by inline assembler or some ugly workarounds (shifts and or-s)?
>> Yes. I think there's already a feature request to provide these
>> operations, but no one worked on it yet.
> Why don't use this code?
> function brol(b: byte; c: byte): byte; assembler; inline;
> movb b,%al
> movb c,%cl
> rolb %cl,%al
> movb %al,result
> end ['al','cl'];
With register calling convention (which is the default calling convention
in FPC 2.x), it can be reduced just to:
function brol(b: byte; c: byte): byte; assembler; inline;
(and similarly for all the other functions). The first parameter goes to
eax, the second to ecx, and the result is supposed to be in eax again.
More information about the fpc-pascal