Russ Hamilton | 385541b | 2023-07-06 00:30:38 | [diff] [blame] | 1 | // Copyright 2023 The Chromium Authors |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef COMPONENTS_CBOR_FLOAT_CONVERSIONS_H_ |
| 6 | #define COMPONENTS_CBOR_FLOAT_CONVERSIONS_H_ |
| 7 | |
| 8 | #include <cstdint> |
| 9 | |
| 10 | namespace cbor { |
| 11 | |
| 12 | // Convert the half-precision float in the provided `value` to a double |
| 13 | // precision floating point number. |
| 14 | double DecodeHalfPrecisionFloat(uint16_t value); |
| 15 | |
| 16 | // Convert the double precision float in the provided `value` to a |
| 17 | // half-precision floating point number. The output is only meaningful if the |
| 18 | // value can be represented in half-precision. |
| 19 | uint16_t EncodeHalfPrecisionFloat(double value); |
| 20 | |
| 21 | } // namespace cbor |
| 22 | |
| 23 | #endif // COMPONENTS_CBOR_FLOAT_CONVERSIONS_H_ |