I have an uint64_t
and I want to store in it, as its rightmost 32 bits, a float
.
Basically, what I want is, given a float f
:
|--------------------------------|--------------------------------|
| 32 bits set to 0 | the 32 bits of our float |
|================================|================================|
^ ^
^ 64-bit unsigned integer ^
|-----------------------------------------------------------------|
I've tried casting it (uint_64t)f
, but the results are a bit weird.
Any ideas?