Artifact 80d6730d2c161aa483a031c445e391322fcb51f4:
- File
_lib/typical/bitop.cpp
- 2011-02-23 09:21:16 - part of checkin [4fd800b3a8] on branch trunk - Copied from private svn repository. (user: kinaba) [annotate]
- File
lib/typical/bitop.cpp
- 2011-02-23 11:18:09 - part of checkin [23dfcca431] on branch trunk - renamed _lib to lib (user: kinaba) [annotate]
0000: 69 6e 74 20 62 69 74 63 6e 74 28 4c 4c 20 78 29 int bitcnt(LL x) 0010: 0a 7b 0a 09 69 6e 74 20 63 20 3d 20 30 3b 0a 09 .{..int c = 0;.. 0020: 66 6f 72 28 3b 20 78 3b 20 78 3e 3e 3d 31 29 0a for(; x; x>>=1). 0030: 09 09 63 20 2b 3d 20 78 26 31 3b 0a 09 72 65 74 ..c += x&1;..ret 0040: 75 72 6e 20 63 3b 0a 7d 0a urn c;.}.