Jonathan I. Kamens [Thu, 3 Dec 1998 15:10:17 +0000 (10:10 -0500)]
Message-Id: <
199812032010.PAA09692@jik.shore.net>
p4raw-id: //depot/perl@2748
computes the same number as the System V sum program:
while (<>) {
- $checksum += unpack("%16C*", $_);
+ $checksum += unpack("%32C*", $_);
}
- $checksum %= 65536;
+ $checksum %= 65535;
The following efficiently counts the number of set bits in a bit vector: