mirror of
https://github.com/dbalsom/x86_microcode.git
synced 2026-06-16 13:07:07 +03:00
13 lines
248 B
C++
13 lines
248 B
C++
#include "alfe/main.h"
|
|
|
|
#ifndef INCLUDED_WRAP_H
|
|
#define INCLUDED_WRAP_H
|
|
|
|
// Works like the % operator but doesn't reflect around 0
|
|
template<class T> T wrap(const T& a, const T& b)
|
|
{
|
|
return a < 0 ? b - (-a)%b : a%b;
|
|
}
|
|
|
|
#endif // INCLUDED_WRAP_H
|