Event struct via registers

Vitaliy Fadeev vital.fadeev at gmail.com
Sat Aug 10 08:39:07 UTC 2024


On Saturday, 10 August 2024 at 08:29:20 UTC, Vitaliy Fadeev wrote:
> On Saturday, 10 August 2024 at 08:10:10 UTC, Vitaliy Fadeev 
> wrote:
>> On Saturday, 10 August 2024 at 08:04:10 UTC, Vitaliy Fadeev 
>> wrote:
>>> On Saturday, 10 August 2024 at 07:46:46 UTC, Vitaliy Fadeev 
>>> wrote:
>>>> ## Trouble 1
>>>>
>>>> Pass the structure through registers ?
>>>>
>>>> ## Trouble 2
>>>>
>>>> Wrap the registries in a structure ?
>>>> How to implement on D?
>>>
>>> I try:
>>> ...
>>> 
>>> But i have 0 in r3.
>>> I need help converting the structure `Event_2` into 2 `ulong` 
>>> parameters `type_code_value`, `r3`.
>>
>> D online editor: 
>> https://run.dlang.io/gist/vitalfadeev/38ffcd289bb87c7e02a4992f698090d0?compiler=dmd
>
> May be `union` ?

Thanks, all, for energy!
I do it with `union`:
```
struct
Convertor (T) {
     union {
         T from;
             struct {
                 REG r1;
                 REG r2;
                 REG r3;
                 REG r4;
         }
     }
}
```

```
     auto convertor = Convertor!(EVENT) (e);
     _event (/* this, */ convertor.r1, convertor.r2, convertor.r3);
```



More information about the Digitalmars-d-learn mailing list