Skip to content

Commit 22d2636

Browse files
author
Raghuveer Devulapalli
committed
make custom float functions static
1 parent 67c7534 commit 22d2636

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

utils/custom-float.h

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,32 @@ namespace fp
88
inline constexpr bool is_floating_point_v = std::is_floating_point_v<T>;
99

1010
template <typename T>
11-
bool isnan(T elem)
11+
static bool isnan(T elem)
1212
{
1313
return std::isnan(elem);
1414
}
1515
template <typename T>
16-
bool isunordered(T a, T b)
16+
static bool isunordered(T a, T b)
1717
{
1818
return std::isunordered(a, b);
1919
}
2020
template <typename T>
21-
T max()
21+
static T max()
2222
{
2323
return std::numeric_limits<T>::max();
2424
}
2525
template <typename T>
26-
T min()
26+
static T min()
2727
{
2828
return std::numeric_limits<T>::min();
2929
}
3030
template <typename T>
31-
T infinity()
31+
static T infinity()
3232
{
3333
return std::numeric_limits<T>::infinity();
3434
}
3535
template <typename T>
36-
T quiet_NaN()
36+
static T quiet_NaN()
3737
{
3838
return std::numeric_limits<T>::quiet_NaN();
3939
}
@@ -44,43 +44,43 @@ namespace fp
4444
uint16_t i_;
4545
} Fp16Bits;
4646

47-
_Float16 convert_bits(uint16_t val)
47+
static _Float16 convert_bits(uint16_t val)
4848
{
4949
Fp16Bits temp;
5050
temp.i_ = val;
5151
return temp.f_;
5252
}
5353

5454
template <>
55-
inline constexpr bool is_floating_point_v<_Float16> = true;
55+
[[maybe_unused]] inline constexpr bool is_floating_point_v<_Float16> = true;
5656

5757
template <>
58-
bool isnan<_Float16>(_Float16 elem)
58+
[[maybe_unused]] bool isnan<_Float16>(_Float16 elem)
5959
{
6060
return elem != elem;
6161
}
6262
template <>
63-
bool isunordered<_Float16>(_Float16 a, _Float16 b)
63+
[[maybe_unused]] bool isunordered<_Float16>(_Float16 a, _Float16 b)
6464
{
6565
return isnan(a) || isnan(b);
6666
}
6767
template <>
68-
_Float16 max<_Float16>()
68+
[[maybe_unused]] _Float16 max<_Float16>()
6969
{
7070
return convert_bits(0x7bff);
7171
}
7272
template <>
73-
_Float16 min<_Float16>()
73+
[[maybe_unused]] _Float16 min<_Float16>()
7474
{
7575
return convert_bits(0x0400);
7676
}
7777
template <>
78-
_Float16 infinity<_Float16>()
78+
[[maybe_unused]] _Float16 infinity<_Float16>()
7979
{
8080
return convert_bits(0x7c00);
8181
}
8282
template <>
83-
_Float16 quiet_NaN<_Float16>()
83+
[[maybe_unused]] _Float16 quiet_NaN<_Float16>()
8484
{
8585
return convert_bits(0x7c01);
8686
}

0 commit comments

Comments
 (0)