[DiscordArchive] <@367784837370609664> how do I tell c# not to allign my structs?
[DiscordArchive] <@367784837370609664> how do I tell c# not to allign my structs?
Archived author: Deleted User • Posted: 2018-05-29T12:24:20.096000+00:00
Original source
Absolutely
Archived author: Deleted User • Posted: 2018-05-29T12:24:28.510000+00:00
Original source
My example was from C++
Archived author: Warpten • Posted: 2018-05-29T12:25:07.077000+00:00
Original source
Even if you're trying to deserialize a byte[] into your T with pointer hacks like
```cs
public T To<T>(this byte[] buffer) where T : unmanaged
{
fixed (byte* b = buffer)
return *(T*)&b[0];
}
```
Archived author: Warpten • Posted: 2018-05-29T12:25:17.186000+00:00
Original source
And please don't do that you you will get garbage anyway, but you get the idea
Archived author: Warpten • Posted: 2018-05-29T12:25:41.163000+00:00
Original source
my point being that usually it's faster tomanually read a struct field by field rather than using the marshaller
Archived author: Warpten • Posted: 2018-05-29T12:28:36.907000+00:00
Original source
thankfully since apparently your type is purely made of value types you should be fine