MCPcopy Create free account
hub / github.com/Tripwire/tripwire-open-source / AtomicInverseModPower2

Function AtomicInverseModPower2

src/cryptlib/integer.cpp:412–427  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

410}
411
412static void AtomicInverseModPower2(word *C, word A0, word A1)
413{
414 assert(A0%2==1);
415
416 const dword A = MAKE_DWORD(A0, A1);
417 dword_union R;
418 R.dw = A0%8;
419
420 for (unsigned i=3; i<2*WORD_BITS; i*=2)
421 R.dw = R.dw*(2-R.dw*A);
422
423 assert(R.dw*A==1);
424
425 C[0] = R.low;
426 C[1] = R.high;
427}
428
429// ********************************************************
430

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected