Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 91a4df12 authored by Krzysztof Kosiński's avatar Krzysztof Kosiński
Browse files

Add default constructor to android::half.

This allows the use of android::half in dynamically allocated
arrays, which I need in a device driver I am working on.

Bug: 155932921
Test: presubmit, atest
Change-Id: Ia3e0e404454186240433652d6d1cf6705ced2dce
parent 422036d8
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -82,6 +82,7 @@ class half {
    };

public:
    CONSTEXPR half() noexcept { }
    CONSTEXPR half(float v) noexcept : mBits(ftoh(v)) { }
    CONSTEXPR operator float() const noexcept { return htof(mBits); }

+1 −0
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ TEST_F(HalfTest, Basics) {
    EXPECT_EQ(2UL, sizeof(half));

    // test +/- zero
    EXPECT_EQ(0x0000, half().getBits());
    EXPECT_EQ(0x0000, half( 0.0f).getBits());
    EXPECT_EQ(0x8000, half(-0.0f).getBits());