I'm trying to cast a variable of type layout
with a size of 4 bytes to an uint32
. It is however not working.
A layout:
typedef layout "little-endian" {
uint16 NSQA;
uint16 NCQR;
} DW0_set_features_fid_07;
then
local DW0_set_features_fid_07 DW0 = {
.NSQA = max_ioqpairs,
.NCQR = max_ioqpairs
};
local uint32 four_bytes = cast(DW0, uint32);
memcpy
does however work:
local DW0_set_features_fid_07 DW0 = {
.NSQA = 64,
.NCQR = 64
};
local uint32 four_bytes;
memcpy(&four_bytes, &DW0, sizeoftype(uint32));
Am I making a mistake here when using cast
?