MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / DivideFourWordsByTwo

Function DivideFourWordsByTwo

extra/yassl/taocrypt/src/integer.cpp:393–409  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

391// do a 4 word by 2 word divide, returns 2 word quotient in Q0 and Q1
392template <class S, class D>
393inline D DivideFourWordsByTwo(S *T, const D &Al, const D &Ah, const D &B)
394{
395 if (!B) // if divisor is 0, we assume divisor==2**(2*WORD_BITS)
396 return D(Ah.GetLowHalf(), Ah.GetHighHalf());
397 else
398 {
399 S Q[2];
400 T[0] = Al.GetLowHalf();
401 T[1] = Al.GetHighHalf();
402 T[2] = Ah.GetLowHalf();
403 T[3] = Ah.GetHighHalf();
404 Q[1] = DivideThreeWordsByTwo<S, D>(T+1, B.GetLowHalf(),
405 B.GetHighHalf());
406 Q[0] = DivideThreeWordsByTwo<S, D>(T, B.GetLowHalf(), B.GetHighHalf());
407 return D(Q[0], Q[1]);
408 }
409}
410
411
412// returns quotient, which must fit in a word

Callers

nothing calls this directly

Calls 2

GetLowHalfMethod · 0.45
GetHighHalfMethod · 0.45

Tested by

no test coverage detected