I thought delphi was the same as objfpc, but you taught me otherwise
after changing mode from objfpc to delphi and (@Bound, @Unbound) to (Bound, Unbound) i feel more like passing a procedure and not a pointer, but still i get this error:
Error: Typed constants of the type 'procedure is nested' can only be initialized with NIL and global procedures/functions
or just illegal Expression, when trying to use Pointers.
Right now im fideling with the use of const Pointers, but from what i get, a pointer to a nested function also needs the bsp (base stack ptr) of the parent method, which i wouldn't be needing, because i would call it only from the function itself.
After that i'll try to do it with assembly. I'll report back with the results :-)
But before that, i'll sleep for a while
@User137:
By doing so "effecient" would mean less memory but in my case this is critical code.
With Instruction-Prefetching, Pipelining and Branch-Prediction in mind, writing "if a <> b then" results in
cmp a,b
jz $bla // this is the "bad" instruction
Typically with at least intel-cpus:
1. This code cannot be torn apart, because other instructions might change flags. This prevents OOOE.(Google: OOO-Execution)
2. anytime there is a conditional jump, the cpu builds a table to try to predict which branch will be taken so that the instructions can be put in
3. The pipeline. When the cpus fetches operands that are going to be written back by a previous instruction, the Von Neumann-property is violated and the pipeline has to be flushed. This can take up to 20 cycles. Don't want that in a critical section
4. + as result of that another thread might be scheduled to run in the meantime, which will probably replace to page of instructions cached in the cpu, which is also bad, because there already are carefully chosen timers that should make sure that threads run as parallel as they can
AMD does some things differently and they don't stick to optimizations they introduce, that's why i'm not doing optimization for AMD.