more changes
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
#include "util.hpp"
|
||||
|
||||
namespace bigmath {
|
||||
|
||||
u64 ipow(u64 b, u64 p) {
|
||||
// FROM stack overflow
|
||||
// "The most efficient way to implement [int pow]"
|
||||
u64 r = 1;
|
||||
for(;;) {
|
||||
if(p & 1) r *= b;
|
||||
p >>= 1;
|
||||
if(!p) break;
|
||||
b *= b;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
#include <bigmath/BigMath.hpp>
|
||||
|
||||
namespace bigmath {
|
||||
|
||||
template<typename T>
|
||||
struct div_result {
|
||||
T quot;
|
||||
T remain;
|
||||
};
|
||||
|
||||
u64 ipow(u64 b, u64 p);
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user