From 83c4a5ed376fa42dbe22a6700cfa223d38a55b0a Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Thu, 28 Jul 2016 08:33:38 -0400 Subject: [PATCH] minor cleanup to aux io functions (#962) --- include/libtorrent/aux_/io.hpp | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/include/libtorrent/aux_/io.hpp b/include/libtorrent/aux_/io.hpp index eb95bee77..548929b9b 100644 --- a/include/libtorrent/aux_/io.hpp +++ b/include/libtorrent/aux_/io.hpp @@ -67,26 +67,13 @@ namespace libtorrent { namespace aux for (int i = 0; i < int(sizeof(T)); ++i) { shift -= 8; - view[i] = static_cast((val >> shift) & 0xff); + view[i] = static_cast((val >> shift) & 0xff); } view = view.subspan(sizeof(T)); } - template - inline typename std::enable_if::type - write_impl(std::uint8_t val, span& view) - { - view[0] = val; - view = view.subspan(1); - } - - template - inline typename std::enable_if::type - write_impl(std::int8_t val, span& view) - { - view[0] = val; - view = view.subspan(1); - } + // the single-byte case is separate to avoid a warning on the shift-left by + // 8 bits (which invokes undefined behavior) template inline typename std::enable_if::type