| 412 | } |
| 413 | |
| 414 | size_t f2Data(byte* buf, float f, ByteOrder byteOrder) { |
| 415 | // This algorithm assumes that the internal representation of the float |
| 416 | // type is the 4-byte IEEE 754 binary32 format, which is common but not |
| 417 | // required by the C++ standard. |
| 418 | union { |
| 419 | uint32_t ul_; |
| 420 | float f_; |
| 421 | } u; |
| 422 | u.f_ = f; |
| 423 | return ul2Data(buf, u.ul_, byteOrder); |
| 424 | } |
| 425 | |
| 426 | size_t d2Data(byte* buf, double d, ByteOrder byteOrder) { |
| 427 | // This algorithm assumes that the internal representation of the double |