-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TLV reader: Improve floating-point support
1. For some reason the Get(float&) signature was declared in the .h file but never defined. Define it as well, extracting a helper function for both Get(float&) and Get(double&). 2. It is undefined behaviour to use unions for type-punning in C++. Use raw memcpy calls instead, which is well-defined (std::bit_cast is not available). Compilers will generally be able to optimize this away unless a freestanding implementation (with possibly non-standard memcpy) is used.
- Loading branch information
Showing
2 changed files
with
37 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters