From 64cdf9ccfb87248b604ab829e8c051bc95aa23f1 Mon Sep 17 00:00:00 2001 From: Pascal Serrarens Date: Sun, 12 Jan 2025 09:07:14 +0100 Subject: [PATCH] Fixes --- LinearAlgebra/Spherical.cpp | 2 +- Sensors/TemperatureSensor.cpp | 2 ++ Sensors/TemperatureSensor.h | 1 + float16.cpp | 7 +++++++ 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/LinearAlgebra/Spherical.cpp b/LinearAlgebra/Spherical.cpp index 10ffd48..b12ea01 100644 --- a/LinearAlgebra/Spherical.cpp +++ b/LinearAlgebra/Spherical.cpp @@ -123,7 +123,7 @@ const SphericalOf SphericalOf::down = template SphericalOf SphericalOf::WithDistance(float distance) { SphericalOf v = SphericalOf(distance, this->direction); - return SphericalOf(); + return v; } template SphericalOf SphericalOf::operator-() const { diff --git a/Sensors/TemperatureSensor.cpp b/Sensors/TemperatureSensor.cpp index 6cc1644..9fe5c67 100644 --- a/Sensors/TemperatureSensor.cpp +++ b/Sensors/TemperatureSensor.cpp @@ -7,6 +7,8 @@ namespace Control { // TemperatureSensor::TemperatureSensor() : Thing(Type::TemperatureSensor) {} +TemperatureSensor::TemperatureSensor() : Thing(Type::TemperatureSensor) {} + TemperatureSensor::TemperatureSensor(unsigned char networkId, unsigned char thingId) : Thing(nullptr, networkId, thingId, Type::TemperatureSensor) {} diff --git a/Sensors/TemperatureSensor.h b/Sensors/TemperatureSensor.h index 22f8083..d4f5142 100644 --- a/Sensors/TemperatureSensor.h +++ b/Sensors/TemperatureSensor.h @@ -7,6 +7,7 @@ namespace Control { class TemperatureSensor : public Thing { public: + TemperatureSensor(); TemperatureSensor(unsigned char networkId, unsigned char thingId); virtual void SetTemperature(float temp); diff --git a/float16.cpp b/float16.cpp index a084f22..041b3d3 100644 --- a/float16.cpp +++ b/float16.cpp @@ -188,6 +188,13 @@ float float16::f16tof32(uint16_t _value) const { } uint16_t float16::f32tof16(float f) const { + // untested code, but will avoid strict aliasing warning + // union { + // float f; + // uint32_t t; + // } u; + // u.f = f; + // uint32_t t = u.t; uint32_t t = *(uint32_t *)&f; // man bits = 10; but we keep 11 for rounding uint16_t man = (t & 0x007FFFFF) >> 12;