[fpc-pascal] rotating bits
Tomas Hajny
XHajT03 at mbox.vol.cz
Thu May 25 00:57:51 CEST 2006
On 25 May 06, at 0:10, ϸňđ Ęîńŕđĺâńęčé ń mail.ru wrote:
> >> First parameter is in eax, second in edx (third one is ecx)
> TH> Yes, of course, sorry for confusion... :-( Anyway, loading of the first
> TH> parameter can be still skipped (and the stack frame is probably not useful
> TH> in this case either). So you'd get:
> TH> function brol(b: byte; c: byte): byte; assembler; nostackframe;
> TH> asm
> TH> movb %dl,%cl
> TH> rolb %cl,%al
> TH> end ['cl'];
> TH> Tomas
>
> 1. So, is there any problem with including this functions and bit checks
> (bt./bs. in intel assembler: writing (a and (1 shl i)) isn't great too)?
I guess there is no problem in including it. The
only questions from my point of view are:
1) Are they useful in general, so that it would
make sense to include them either in FPC itself
(as opposed to some standalone unit)?
2) If they are to be included, should they be
included as functions, or possibly even as
operators (similarly to existing shl/shr)?
3) If we decide to include them as functions,
where (which unit)?
I personally don't have an answer for the first
question. What would be the typical use? For the
rest, my suggestion would be operators rather
than functions (if they are really needed), but
that would need somebody else than me to add the
appropriate compiler support (probably not a big
deal, I guess).
> 2. Are calling conventions a subject to change?
Possibly, although I wouldn't expect it any more.
> Are there ways to know
> about calling convention used (with {$ifdefs} e.g.)?
If you need to support pre-2.x versions (and
especially early 1.9.x betas when the change
happened), then you could use {$IFDEF REGCALL}.
For 2.x+, using {$CALLING REGISTER} can be used
to force that calling convention (regardless of
the default).
Tomas
More information about the fpc-pascal
mailing list