Skip to content

Commit c5e4181

Browse files
committed
consider c++17 or before
1 parent f9523a7 commit c5e4181

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

test/reference.hpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
#pragma once
22

3+
#ifdef __cpp_lib_bit_cast
34
#include <bit>
5+
#else
6+
#include <memory.h>
7+
#endif
48
#include "table.h"
59

610
inline uint32_t f2u(float x)
711
{
8-
#if 1
12+
#ifdef __cpp_lib_bit_cast
913
return std::bit_cast<uint32_t>(x);
1014
#else
1115
uint32_t u;
@@ -16,7 +20,7 @@ inline uint32_t f2u(float x)
1620

1721
inline float u2f(uint32_t x)
1822
{
19-
#if 1
23+
#ifdef __cpp_lib_bit_cast
2024
return std::bit_cast<float>(x);
2125
#else
2226
float f;

0 commit comments

Comments
 (0)