Mapping float to ulong in CTFE

berni44 dlang at d-ecke.de
Fri Dec 13 09:06:55 UTC 2019


On Thursday, 12 December 2019 at 19:39:16 UTC, Petar Kirov 
[ZombineDev] wrote:
> You can use a C-style pointer reinterpret cast like this:
>
> uint test(float f) { return *cast(uint*)&f; }
>
> Make sure that source and destination types have the same size.

Hey, great! :-)


More information about the Digitalmars-d-learn mailing list