Elegant D

Dom Disc dominikus at scherkl.de
Tue Dec 2 14:21:05 UTC 2025


On Tuesday, 2 December 2025 at 05:08:39 UTC, Walter Bright wrote:
> It's a nice idea, but is very fragile. The exact registers that 
> are used are very sensitive to every detail, and hard to 
> predict.
Not in this case. The assembler documentation states that mul 
puts its result in registers RAX:RDX (or EAX:EDX for 32bit etc.)
And the carry-flag is also well documented. Also RAX is always 
the return value.
But of course it's very Intel specific.

> 1. write the whole dang thing in assembler
I've done this and I hate it. It always requires extra steps to 
generate and include the other object file and I run always in 
some name-mangling problems.
The solution with inline assembler feels so much more natural and 
is so easy readable - just, well, elegant.

> 2. write a recognizer for it and custom code generation
I have no idea how to do this.



More information about the Digitalmars-d mailing list