summaryrefslogtreecommitdiff
path: root/include/lib/ArduinoJson/MsgPack/ieee754.hpp
blob: 016d5334d7dbce84d05201eb29367dde7345d27e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// ArduinoJson - https://arduinojson.org
// Copyright Benoit Blanchon 2014-2021
// MIT License

#pragma once

#include <ArduinoJson/Namespace.hpp>

namespace ARDUINOJSON_NAMESPACE {

inline void doubleToFloat(const uint8_t d[8], uint8_t f[4]) {
  f[0] = uint8_t((d[0] & 0xC0) | (d[0] << 3 & 0x3f) | (d[1] >> 5));
  f[1] = uint8_t((d[1] << 3) | (d[2] >> 5));
  f[2] = uint8_t((d[2] << 3) | (d[3] >> 5));
  f[3] = uint8_t((d[3] << 3) | (d[4] >> 5));
}

}  // namespace ARDUINOJSON_NAMESPACE