MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / Div3_Normalize

Method Div3_Normalize

extern/ttmath/ttmathuint.h:2227–2250  ·  view source on GitHub ↗

! we're moving all bits from 'v' into the left side of the n-1 word (the highest bit at v.table[n-1] will be equal one, the bits from 'this' we're moving the same times as 'v') return values: d - how many times we've moved return - the next-left value from 'this' (that after table[value_size-1]) */

Source from the content-addressed store, hash-verified

2225 return - the next-left value from 'this' (that after table[value_size-1])
2226 */
2227 uint Div3_Normalize(UInt<value_size> & v, uint n, uint & d)
2228 {
2229 // v.table[n-1] is != 0
2230
2231 uint bit = (uint)FindLeadingBitInWord(v.table[n-1]);
2232 uint move = (TTMATH_BITS_PER_UINT - bit - 1);
2233 uint res = table[value_size-1];
2234 d = move;
2235
2236 if( move > 0 )
2237 {
2238 v.Rcl(move, 0);
2239 Rcl(move, 0);
2240 res = res >> (bit + 1);
2241 }
2242 else
2243 {
2244 res = 0;
2245 }
2246
2247 TTMATH_LOG("UInt::Div3_Normalize")
2248
2249 return res;
2250 }
2251
2252
2253 void Div3_Unnormalize(UInt<value_size> * remainder, uint n, uint d)

Callers

nothing calls this directly

Calls 1

RclMethod · 0.80

Tested by

no test coverage detected