diff --git a/apps/m17-mod.cpp b/apps/m17-mod.cpp index eb16910..2c1bd43 100644 --- a/apps/m17-mod.cpp +++ b/apps/m17-mod.cpp @@ -22,7 +22,6 @@ #include #include -#include #include #include #include @@ -34,12 +33,12 @@ #include // Generated using scikit-commpy -const auto rrc_taps = std::experimental::make_array( +const auto rrc_taps = std::array{ 0.0029364388513841593, 0.0031468394550958484, 0.002699564567597445, 0.001661182944400927, 0.00023319405581230247, -0.0012851320781224025, -0.0025577136087664687, -0.0032843366522956313, -0.0032697038088887226, -0.0024733964729590865, -0.0010285696910973807, 0.0007766690889758685, 0.002553421969211845, 0.0038920145144327816, 0.004451886520053017, 0.00404219185231544, 0.002674727068399207, 0.0005756567993179152, -0.0018493784971116507, -0.004092346891623224, -0.005648131453822014, -0.006126925416243605, -0.005349511529163396, -0.003403189203405097, -0.0006430502751187517, 0.002365929161655135, 0.004957956568090113, 0.006506845894531803, 0.006569574194782443, 0.0050017573119839134, 0.002017321931508163, -0.0018256054303579805, -0.00571615173291049, -0.008746639552588416, -0.010105075751866371, -0.009265784007800534, -0.006136551625729697, -0.001125978562075172, 0.004891777252042491, 0.01071805138282269, 0.01505751553351295, 0.01679337935001369, 0.015256245142156299, 0.01042830577908502, 0.003031522725559901, -0.0055333532968188165, -0.013403099825723372, -0.018598682349642525, -0.01944761739590459, -0.015005271935951746, -0.0053887880354343935, 0.008056525910253532, 0.022816244158307273, 0.035513467692208076, 0.04244131815783876, 0.04025481153629372, 0.02671818654865632, 0.0013810216516704976, -0.03394615682795165, -0.07502635967975885, -0.11540977897637611, -0.14703962203941534, -0.16119995609538576, -0.14969512896336504, -0.10610329539459686, -0.026921412469634916, 0.08757875030779196, 0.23293327870303457, 0.4006012210123992, 0.5786324696325503, 0.7528286479934068, 0.908262741447522, 1.0309661131633199, 1.1095611856548013, 1.1366197723675815, 1.1095611856548013, 1.0309661131633199, 0.908262741447522, 0.7528286479934068, 0.5786324696325503, 0.4006012210123992, 0.23293327870303457, 0.08757875030779196, -0.026921412469634916, -0.10610329539459686, -0.14969512896336504, -0.16119995609538576, -0.14703962203941534, -0.11540977897637611, -0.07502635967975885, -0.03394615682795165, 0.0013810216516704976, 0.02671818654865632, 0.04025481153629372, 0.04244131815783876, 0.035513467692208076, 0.022816244158307273, 0.008056525910253532, -0.0053887880354343935, -0.015005271935951746, -0.01944761739590459, -0.018598682349642525, -0.013403099825723372, -0.0055333532968188165, 0.003031522725559901, 0.01042830577908502, 0.015256245142156299, 0.01679337935001369, 0.01505751553351295, 0.01071805138282269, 0.004891777252042491, -0.001125978562075172, -0.006136551625729697, -0.009265784007800534, -0.010105075751866371, -0.008746639552588416, -0.00571615173291049, -0.0018256054303579805, 0.002017321931508163, 0.0050017573119839134, 0.006569574194782443, 0.006506845894531803, 0.004957956568090113, 0.002365929161655135, -0.0006430502751187517, -0.003403189203405097, -0.005349511529163396, -0.006126925416243605, -0.005648131453822014, -0.004092346891623224, -0.0018493784971116507, 0.0005756567993179152, 0.002674727068399207, 0.00404219185231544, 0.004451886520053017, 0.0038920145144327816, 0.002553421969211845, 0.0007766690889758685, -0.0010285696910973807, -0.0024733964729590865, -0.0032697038088887226, -0.0032843366522956313, -0.0025577136087664687, -0.0012851320781224025, 0.00023319405581230247, 0.001661182944400927, 0.002699564567597445, 0.0031468394550958484, 0.0029364388513841593, 0.0 -); +}; -const auto evm_b = std::experimental::make_array(0.02008337, 0.04016673, 0.02008337); -const auto evm_a = std::experimental::make_array(1.0, -1.56101808, 0.64135154); +const auto evm_b = std::array{0.02008337, 0.04016673, 0.02008337}; +const auto evm_a = std::array{1.0, -1.56101808, 0.64135154}; const char VERSION[] = "2.2"; diff --git a/include/m17cxx/Convolution.h b/include/m17cxx/Convolution.h index 4f28b18..e84eeac 100644 --- a/include/m17cxx/Convolution.h +++ b/include/m17cxx/Convolution.h @@ -5,6 +5,11 @@ #include #include +#ifdef _MSC_VER +# include +# define __builtin_popcount __popcnt +#endif + namespace mobilinkd { diff --git a/include/m17cxx/Fsk4Demod.h b/include/m17cxx/Fsk4Demod.h index 88892d2..b58d6dc 100644 --- a/include/m17cxx/Fsk4Demod.h +++ b/include/m17cxx/Fsk4Demod.h @@ -9,7 +9,6 @@ #include "SymbolEvm.h" #include -#include #include #include @@ -18,7 +17,7 @@ namespace mobilinkd namespace detail { -inline const auto rrc_taps = std::experimental::make_array( +inline const auto rrc_taps = std::array( -0.009265784007800534, -0.006136551625729697, -0.001125978562075172, 0.004891777252042491, 0.01071805138282269, 0.01505751553351295, 0.01679337935001369, 0.015256245142156299, 0.01042830577908502, 0.003031522725559901, -0.0055333532968188165, -0.013403099825723372, @@ -41,8 +40,8 @@ inline const auto rrc_taps = std::experimental::make_array( -0.001125978562075172, -0.006136551625729697, -0.009265784007800534 ); -inline const auto evm_b = std::experimental::make_array(0.02008337, 0.04016673, 0.02008337); -inline const auto evm_a = std::experimental::make_array(1.0, -1.56101808, 0.64135154); +inline const auto evm_b = std::array(0.02008337, 0.04016673, 0.02008337); +inline const auto evm_a = std::array(1.0, -1.56101808, 0.64135154); } // detail struct Fsk4Demod diff --git a/include/m17cxx/Golay24.h b/include/m17cxx/Golay24.h index 58c2f0f..d2d8512 100644 --- a/include/m17cxx/Golay24.h +++ b/include/m17cxx/Golay24.h @@ -8,6 +8,11 @@ #include #include +#ifdef _MSC_VER +# include +# define __builtin_popcount __popcnt +#endif + namespace mobilinkd { // Parts are adapted from: diff --git a/include/m17cxx/M17Demodulator.h b/include/m17cxx/M17Demodulator.h index 3a21f11..7970ed1 100644 --- a/include/m17cxx/M17Demodulator.h +++ b/include/m17cxx/M17Demodulator.h @@ -30,7 +30,7 @@ struct Taps template <> struct Taps { - static constexpr auto rrc_taps = std::experimental::make_array( + static constexpr auto rrc_taps = std::array{ 0.0029364388513841593, 0.0031468394550958484, 0.002699564567597445, 0.001661182944400927, 0.00023319405581230247, -0.0012851320781224025, -0.0025577136087664687, -0.0032843366522956313, -0.0032697038088887226, -0.0024733964729590865, -0.0010285696910973807, 0.0007766690889758685, @@ -69,13 +69,13 @@ struct Taps -0.0032697038088887226, -0.0032843366522956313, -0.0025577136087664687, -0.0012851320781224025, 0.00023319405581230247, 0.001661182944400927, 0.002699564567597445, 0.0031468394550958484, 0.0029364388513841593, 0.0 - ); + }; }; template <> struct Taps { - static constexpr auto rrc_taps = std::experimental::make_array( + static constexpr auto rrc_taps = std::array{ 0.0029364388513841593, 0.0031468394550958484, 0.002699564567597445, 0.001661182944400927, 0.00023319405581230247, -0.0012851320781224025, -0.0025577136087664687, -0.0032843366522956313, -0.0032697038088887226, -0.0024733964729590865, -0.0010285696910973807, 0.0007766690889758685, @@ -114,7 +114,7 @@ struct Taps -0.0032697038088887226, -0.0032843366522956313, -0.0025577136087664687, -0.0012851320781224025, 0.00023319405581230247, 0.001661182944400927, 0.002699564567597445, 0.0031468394550958484, 0.0029364388513841593, 0.0 - ); + }; }; } // detail diff --git a/include/m17cxx/M17Modulator.h b/include/m17cxx/M17Modulator.h index 617a4fe..a925722 100644 --- a/include/m17cxx/M17Modulator.h +++ b/include/m17cxx/M17Modulator.h @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include @@ -594,7 +593,7 @@ public: static baseband_t symbols_to_baseband(const symbols_t& symbols) { // Generated using scikit-commpy - static const auto rrc_taps = std::experimental::make_array( + static const auto rrc_taps = std::array{ -0.009265784007800534, -0.006136551625729697, -0.001125978562075172, 0.004891777252042491, 0.01071805138282269, 0.01505751553351295, 0.01679337935001369, 0.015256245142156299, 0.01042830577908502, 0.003031522725559901, -0.0055333532968188165, -0.013403099825723372, @@ -615,7 +614,7 @@ public: -0.0055333532968188165, 0.003031522725559901, 0.01042830577908502, 0.015256245142156299, 0.01679337935001369, 0.01505751553351295, 0.01071805138282269, 0.004891777252042491, -0.001125978562075172, -0.006136551625729697, -0.009265784007800534 - ); + }; static BaseFirFilter::value> rrc = makeFirFilter(rrc_taps); std::array baseband; diff --git a/include/m17cxx/M17Randomizer.h b/include/m17cxx/M17Randomizer.h index b9a87fa..e7c41e9 100644 --- a/include/m17cxx/M17Randomizer.h +++ b/include/m17cxx/M17Randomizer.h @@ -3,7 +3,6 @@ #pragma once #include -#include #include #include @@ -14,13 +13,13 @@ namespace detail { // M17 randomization matrix. -inline auto DC = std::experimental::make_array( +inline auto DC = std::array{ 0xd6, 0xb5, 0xe2, 0x30, 0x82, 0xFF, 0x84, 0x62, 0xba, 0x4e, 0x96, 0x90, 0xd8, 0x98, 0xdd, 0x5d, 0x0c, 0xc8, 0x52, 0x43, 0x91, 0x1d, 0xf8, 0x6e, 0x68, 0x2F, 0x35, 0xda, 0x14, 0xea, 0xcd, 0x76, 0x19, 0x8d, 0xd5, 0x80, 0xd1, 0x33, 0x87, 0x13, - 0x57, 0x18, 0x2d, 0x29, 0x78, 0xc3); + 0x57, 0x18, 0x2d, 0x29, 0x78, 0xc3}; } template diff --git a/include/m17cxx/M17Synchronizer.h b/include/m17cxx/M17Synchronizer.h index 1861ed3..c7db653 100644 --- a/include/m17cxx/M17Synchronizer.h +++ b/include/m17cxx/M17Synchronizer.h @@ -4,6 +4,11 @@ #include +#ifdef _MSC_VER +# include +# define __builtin_popcount __popcnt +#endif + namespace mobilinkd { diff --git a/include/m17cxx/Trellis.h b/include/m17cxx/Trellis.h index c530b79..172bb92 100644 --- a/include/m17cxx/Trellis.h +++ b/include/m17cxx/Trellis.h @@ -8,7 +8,6 @@ #include "Convolution.h" #include -#include #include #include @@ -31,14 +30,14 @@ inline constexpr std::array make_p1() { inline constexpr auto P1 = make_p1(); /// Puncture matrix for audio frames. Rate 6/11. -inline constexpr auto P2 = std::experimental::make_array( +inline constexpr auto P2 = std::array{ 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 0); + 1, 1, 1, 1, 1, 0}; /// Puncture matrix for packet frames (7/8). -inline constexpr auto P3 = std::experimental::make_array( - 1, 1, 1, 1, 1, 1, 1, 0); +inline constexpr auto P3 = std::array{ + 1, 1, 1, 1, 1, 1, 1, 0}; /** * Convert an integer value to an array of bits, with the diff --git a/include/m17cxx/Util.h b/include/m17cxx/Util.h index ef9a05d..7aca344 100644 --- a/include/m17cxx/Util.h +++ b/include/m17cxx/Util.h @@ -271,10 +271,10 @@ size_t puncture_bytes(const std::array& in, template constexpr T to_int(uint8_t v) { - constexpr auto MAX_INPUT = (1 << (n - 1)); - constexpr auto NEGATIVE_OFFSET = std::numeric_limits::type>::max() - (MAX_INPUT - 1); + constexpr auto MAX_LOCAL_INPUT = (1 << (n - 1)); + constexpr auto NEGATIVE_OFFSET = std::numeric_limits::type>::max() - (MAX_LOCAL_INPUT - 1); T r = v & (1 << (n - 1)) ? NEGATIVE_OFFSET : 0; - return r + (v & (MAX_INPUT - 1)); + return r + (v & (MAX_LOCAL_INPUT - 1)); } template