// intellectual property is bullshit bgdc

#ifndef MATH_MISC_HPP
#define MATH_MISC_HPP

#include <stdbool.h>
#include <stddef.h>
#include <inttypes.h>

// Return num/den rounded to the nearest integer. Undefined for negatives
// (TODO clean it up in the future)
template<typename T>
static inline T rounded_div(T num, T den)
{
	T quo = num/den, rem = num%den;
	if (rem >= den/2)
		quo++;
	return quo;
}

#endif // !defined(MATH_MISC_HPP)
