Is there a way to access a member of a struct/class with assembly inline? #62
-
Hi, In the following code, I need to implement the assignment 'ns = 1' in assembly. I've tried something like that but with no luck:
I've tried to compile it with:
|
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 29 replies
-
This works. Unfortunately if has an issue with the inliner - I will check the issue right away :) |
Beta Was this translation helpful? Give feedback.
-
Mmmh... but how can I get the offset of 'ns' in automatic way? Maybe this could be the best solution, if you could write something like: |
Beta Was this translation helpful? Give feedback.
-
I fixed the inline assembler inlining issue, so now you can define the function in the struct definition itself. I also added a P::ns syntax to get the offset of a struct member:
|
Beta Was this translation helpful? Give feedback.
-
Great addition! I'll try it right away. I have another question: can a constant be accessed in inline assembly? Like:
|
Beta Was this translation helpful? Give feedback.
-
I've tried (-O2):
but it's translated in:
So, no immediate mode translation. |
Beta Was this translation helpful? Give feedback.
This works. Unfortunately if has an issue with the inliner - I will check the issue right away :)