cast: add ffs cast

This commit is contained in:
Danny Robson 2018-05-10 13:52:49 +10:00
parent ad90e10c5d
commit 117a870b19

View File

@ -171,6 +171,18 @@ namespace util::cast {
return reinterpret_cast<DstT> (src);
#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