7 #include "cl_integer.h"
17 uintL logcount (const cl_I& x)
20 { var uint32 x32 = FN_to_L(x); // x als 32-Bit-Zahl
21 if (FN_L_minusp(x,(sint32)x32)) { x32 = ~ x32; } // falls <0, komplementieren
22 logcount_32(); // Bits von x32 zählen
26 { var const uintD* MSDptr;
28 BN_to_NDS_nocopy(x, MSDptr=,len=,); // DS zu x bilden, len>0.
29 var uintL bitcount = 0; // Bitzähler
30 var const uintD* ptr = MSDptr; // läuft durch die Digits durch
31 var uintD sign = sign_of_sintD(mspref(ptr,0)); // Vorzeichen
33 { bitcount += (uintL)logcountD(msprefnext(ptr) ^ sign); });
34 // 0 <= bitcount < intDsize*2^intCsize.