Вопрос

How do I convert the following macro into a function?

#define xtime(x)   ((x<<1) ^ (((x>>7) & 1) * 0x1b))
Это было полезно?

Решение

template<typename T>
T xtime(T x)
{
    return ((x<<1) ^ (((x>>7) & 1) * 0x1b));
}
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top