cast: add ffs cast
This commit is contained in:
parent
ad90e10c5d
commit
117a870b19
14
cast.hpp
14
cast.hpp
@ -171,6 +171,18 @@ namespace util::cast {
|
|||||||
return reinterpret_cast<DstT> (src);
|
return reinterpret_cast<DstT> (src);
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
/// cast from SrcT to DstT and damn any consequences.
|
||||||
|
template <typename DstT, typename SrcT>
|
||||||
|
DstT ffs (SrcT src)
|
||||||
|
{
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wcast-align"
|
||||||
|
return reinterpret_cast<DstT> (src);
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user