asm woes...

Era Scarecrow via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat May 28 03:41:09 PDT 2016


On Saturday, 28 May 2016 at 10:10:19 UTC, ZombineDev wrote:
> The great thing about D's UFCS is that it allows exactly that:
>
> <snip>
>
> Also, you can implement inc() in terms of ulong[2] - void 
> inc(ref ulong[2] w), which makes it applicable for other types, 
> with the same memory representation. E.g. cent - 
> (cast(ulong[2]*)&cent).inc(), arrays - ulong[] arr; 
> arr[0..2].inc(), and so on.

  Hmmm if it wasn't wideint being template I'd agree with you. 
Then again the way you have it listed the increment would 
probably call the version that's generated and doesn't require 
specific template instantiation to work.

  I don't know, personally to me it makes more sense to replace 
functions rather than export them and add an unknown generated 
type. If inherited structs worked (as i have them listed) then 
you could export all the CPU specific code to another file and 
never have to even know it exists. And if my impressions of code 
management and portability are accurate, then having 
OS/Architecture specific details should be separate from what is 
openly shared.

  Besides I'd like to leave the original source completely 
untouched if i can while applying updates/changes that don't add 
any confusion to the existing source code; Plus it's more an 
opt-in option at that point where you can hopefully have both 
active at the same time to unittest one against the other. (A is 
known to be correct, so B's output is tested against A).


More information about the Digitalmars-d-learn mailing list