| 30 | |
| 31 | template <typename T> |
| 32 | std::make_unsigned_t<T> ZigZagEncode(T x) |
| 33 | { |
| 34 | static_assert(std::is_signed<T>::value, "Type should be signed"); |
| 35 | return (x << 1) ^ (x >> (sizeof(x) * 8 - 1)); |
| 36 | } |
| 37 | |
| 38 | template <typename T> |
| 39 | std::make_signed_t<T> ZigZagDecode(T x) |
no outgoing calls