I cant find a way to convert guint8 to uint32_t in C
I tried:
uint32_t *uint32_value = (uint32_t *)guint8_value;
but it says:
warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
uint32_t *uint32_value = (uint32_t *)guint8_value
^
warning: assignment makes integer from pointer without a cast [-Wint-conversion]
uint32_t *uint32_value = (uint32_t *)guint8_value
^
You aren't casting from guint8
to uint32_t
.
You are casting from an integer (guint8
) to a pointer to an integer (uint32_t*
)
The correct code is very simple:
uint32_t uint32_value = guint8_value;