#pragma once #include "../std/limits.hpp" namespace bits { template struct bits_of { enum { value = sizeof(T) * CHAR_BIT }; }; template T ror(T val, unsigned int n) { enum { bits = bits_of::value }; n = n % bits; return (val >> n) | (val << (bits - n)); } }