It is in Freepascal. I don't care about much about Delphi - and I don't really remember how it handles pointer arithmetics, too. But the outer loop should be rewritten to asm too, to avoid useless repeated loading of pointers to regs, so the pointer arithmetics can be completely avoided.