You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not a real programmer, but I can use your unit perfectly in my private projects.
If possible I would like a Function BitCount128(b: 128): integer;
Thanks for your great work.
The text was updated successfully, but these errors were encountered:
const
M1: UInt64 = $5555555555555555;
M2: UInt64 = $3333333333333333;
M3: UInt64 = $0F0F0F0F0F0F0F0F;
M4: UInt64 = $00FF00FF00FF00FF;
M5: UInt64 = $0000FFFF0000FFFF;
M6: UInt64 = $00000000FFFFFFFF;
FunctionBitCount64(V: UInt64): Integer; register;
begin
V := (V and M1) + ((V shr1) and M1);
V := (V and M2) + ((V shr2) and M2);
V := (V and M3) + ((V shr4) and M3);
V := (V and M4) + ((V shr8) and M4);
V := (V and M5) + ((V shr16) and M5);
V := (V and M6) + ((V shr32) and M6);
Result := Integer(V);
end;
FunctionBitCount128(V: UInt128): Integer; register;
begin
Result := BitCount64(V.dc0); // c0 is low 64 bitsif V.dc1 <> 0then
Inc(Result, BitCount64(V.dc1)) // c1 is high 64 bitsend;
I'm not a real programmer, but I can use your unit perfectly in my private projects.
If possible I would like a Function BitCount128(b: 128): integer;
Thanks for your great work.
The text was updated successfully, but these errors were encountered: