Thread overview | |||||
---|---|---|---|---|---|
|
May 18, 2015 access member variables within asm | ||||
---|---|---|---|---|
| ||||
Hi, following simple code works well with dmd but LDC won't let me access member variables of a struct that way. How does is work? Is there nice method compatible with both LDC and DMD? thanks in advance module app.d; import std.stdio; struct test { uint a = 42; uint b = 7; uint getA() { uint temp; asm { mov RBX, this; mov EAX, a[RBX]; mov temp, EAX; } return temp; } } public static void main() { writeln("asm 'this' test"); test t; writeln("test.getA(): ", t.getA()); assert(t.getA() == t.a, "getA() failed"); } |
May 26, 2015 Re: access member variables within asm | ||||
---|---|---|---|---|
| ||||
Posted in reply to this.getName() | Hi! That's really a deviation from dmd. Please file an issue for it: https://github.com/ldc-developers/ldc/issues Please not that DMD-style inline assembler is not the best solution for ldc. If you need maximum performance than you should think about creating a solution with ldc style inline assembler. Regards, Kai On Monday, 18 May 2015 at 14:22:29 UTC, this.getName() wrote: > Hi, > following simple code works well with dmd but LDC won't let me access member variables of a struct that way. How does is work? Is there nice method compatible with both LDC and DMD? > > thanks in advance > > module app.d; > > import std.stdio; > > struct test { > uint a = 42; > uint b = 7; > > uint getA() { > uint temp; > asm { > mov RBX, this; > mov EAX, a[RBX]; > mov temp, EAX; > } > return temp; > } > } > > public static void main() { > writeln("asm 'this' test"); > test t; > writeln("test.getA(): ", t.getA()); > assert(t.getA() == t.a, "getA() failed"); > } |
May 30, 2015 Re: access member variables within asm | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kai Nacke | On Tuesday, 26 May 2015 at 16:44:02 UTC, Kai Nacke wrote: > Hi! > > That's really a deviation from dmd. Please file an issue for it: https://github.com/ldc-developers/ldc/issues See https://github.com/ldc-developers/ldc/issues/950 |
Copyright © 1999-2021 by the D Language Foundation