7 #include "cln/integer.h"
19 uintC logcount (const cl_I& x)
22 { var uintV x32 = FN_to_V(x); // x als intDsize-Bit-Zahl
23 if (FN_V_minusp(x,(sintV)x32)) { x32 = ~ x32; } // falls <0, komplementieren
26 logcount_64(); // Bits von x32 zählen
29 logcount_32(); // Bits von x32 zählen
34 { var const uintD* MSDptr;
36 BN_to_NDS_nocopy(x, MSDptr=,len=,); // DS zu x bilden, len>0.
37 var uintC bitcount = 0; // Bitzähler
38 var const uintD* ptr = MSDptr; // läuft durch die Digits durch
39 var uintD sign = sign_of_sintD(mspref(ptr,0)); // Vorzeichen
41 { bitcount += (uintC)logcountD(msprefnext(ptr) ^ sign); });
42 // 0 <= bitcount < intDsize*2^intCsize.