Closed orhun closed 1 year ago
std::mem::transmute_copy causes undefined behavior if the destination type and target type has different sizes. This PR eliminates this issue by using raw pointer to the data and converting it to a u8 slice with the given size.
std::mem::transmute_copy
u8
More detailed explanation: https://stackoverflow.com/questions/25917260/getting-raw-bytes-from-packed-struct
Fixes #62
std::mem::transmute_copy
causes undefined behavior if the destination type and target type has different sizes. This PR eliminates this issue by using raw pointer to the data and converting it to au8
slice with the given size.More detailed explanation: https://stackoverflow.com/questions/25917260/getting-raw-bytes-from-packed-struct
Fixes #62