DUDS
Distributed Update of Data from Something
SignExtend.hpp
Go to the documentation of this file.
1 #include <type_traits>
2 
3 namespace duds { namespace general {
4 
23 template <unsigned B, typename T>
24 inline typename std::make_signed<T>::type SignExtend(const T x) {
25  struct {
26  typename std::make_signed<T>::type x:B;
27  } s;
28  return s.x = (typename std::make_signed<T>::type)x;
29 }
30 
31 } }
std::make_signed< T >::type SignExtend(const T x)
Performs a sign extention operation.
Definition: SignExtend.hpp:24