swc/bundler/tests/.cache/deno/a41e999c2223615484075b574cf34570a0c89864.ts
강동윤 bbaf619f63
fix(bundler): Fix bugs (#1437)
swc_bundler:
 - [x] Fix wrapped esms. (denoland/deno#9307)
 - [x] Make test secure.
2021-03-02 17:33:03 +09:00

14 lines
334 B
TypeScript

// Loaded from https://deno.land/x/god_crypto@v1.4.3/src/math.ts
export function power_mod(n: bigint, p: bigint, m: bigint): bigint {
if (p === 1n) return n;
if (p % 2n === 0n) {
const t = power_mod(n, p >> 1n, m);
return (t * t) % m;
} else {
const t = power_mod(n, p >> 1n, m);
return (t * t * n) % m;
}
}