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