Skip to content

Commit 4b219cc

Browse files
committed
Workaround MSVC conversion warnings. Add /bigobj.
1 parent e0c42d5 commit 4b219cc

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

cmake/setup_target.cmake

+1
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ function (setup_target target)
8787
-U_FORTIFY_SOURCE
8888
-D_FORTIFY_SOURCE=3
8989
)
90+
set (msvc_options /bigobj)
9091

9192
if (LINUX)
9293
# TODO: On AArch64 use -mbranch-protection=standard?

include/midi2/umpToMIDI1Protocol.hpp

+6-3
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ class umpToMIDI1Protocol {
9696
out.w0.channel = in.w0.channel.value();
9797
out.w0.note = in.w0.note.value();
9898
out.w0.velocity = static_cast<std::uint8_t>(
99-
scaleDown(in.w1.velocity, decltype(in.w1.velocity)::bits(), decltype(out.w0.velocity)::bits()));
99+
scaleDown(in.w1.velocity.value(), static_cast<std::uint8_t>(decltype(in.w1.velocity)::bits()),
100+
static_cast<std::uint8_t>(decltype(out.w0.velocity)::bits())));
100101
ctxt->push1(out);
101102
}
102103
void note_on(context_type *const ctxt, types::m2cvm::note_on const &in) const {
@@ -105,15 +106,17 @@ class umpToMIDI1Protocol {
105106
out.w0.channel = in.w0.channel.value();
106107
out.w0.note = in.w0.note.value();
107108
out.w0.velocity = static_cast<std::uint8_t>(
108-
scaleDown(in.w1.velocity, decltype(in.w1.velocity)::bits(), decltype(out.w0.velocity)::bits()));
109+
scaleDown(in.w1.velocity, static_cast<std::uint8_t>(decltype(in.w1.velocity)::bits()),
110+
static_cast<std::uint8_t>(decltype(out.w0.velocity)::bits())));
109111
ctxt->push1(out);
110112
}
111113
void poly_pressure(context_type *const ctxt, types::m2cvm::poly_pressure const &in) const {
112114
types::m1cvm::poly_pressure out;
113115
out.w0.group = in.w0.group.value();
114116
out.w0.channel = in.w0.channel.value();
115117
out.w0.note = in.w0.note.value();
116-
out.w0.pressure = static_cast<std::uint8_t>(scaleDown(in.w1, 32, decltype(out.w0.pressure)::bits()));
118+
out.w0.pressure = static_cast<std::uint8_t>(
119+
scaleDown(in.w1, 32, static_cast<std::uint8_t>(decltype(out.w0.pressure)::bits())));
117120
ctxt->push1(out);
118121
}
119122
void program_change(context_type *const ctxt, types::m2cvm::program_change const &in) const {

include/midi2/ump_types.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,11 @@ template <typename T> constexpr auto status_to_ump_status(T t) {
8282
}
8383
template <> constexpr auto status_to_ump_status(midi2status status) {
8484
auto const s = to_underlying(status);
85-
return s < to_underlying(midi2status::pernote_manage) ? s >> 4 : s;
85+
return static_cast<std::uint8_t>(s < to_underlying(midi2status::pernote_manage) ? s >> 4 : s);
8686
}
8787
template <> constexpr auto status_to_ump_status(status status) {
8888
auto const s = to_underlying(status);
89-
return s < to_underlying(status::sysex_start) ? s >> 4 : s;
89+
return static_cast<std::uint8_t>(s < to_underlying(status::sysex_start) ? s >> 4 : s);
9090
}
9191

9292
//* _ _ _ _ _ *

0 commit comments

Comments
 (0)