diff options
author | peter <peter@FreeBSD.org> | 2002-07-09 02:56:10 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 2002-07-09 02:56:10 +0000 |
commit | 6eb4916dee42174b74d9d3077dd3a4b594452e66 (patch) | |
tree | 09a2ecaee506e51d20c662e00994c651c18baa1d /games/fortune/datfiles/fortunes2 | |
parent | 784b48a6bb9b28dfbe08f290b7497333d1ed9c39 (diff) | |
download | FreeBSD-src-6eb4916dee42174b74d9d3077dd3a4b594452e66.zip FreeBSD-src-6eb4916dee42174b74d9d3077dd3a4b594452e66.tar.gz |
Add C code that counts the bits in a 32 bit word, right next to the C code
that reverses the bits in a 32 bit word. Who thinks up this stuff?
Diffstat (limited to 'games/fortune/datfiles/fortunes2')
-rw-r--r-- | games/fortune/datfiles/fortunes2 | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/games/fortune/datfiles/fortunes2 b/games/fortune/datfiles/fortunes2 index ccd3cd8..7c1f4fd 100644 --- a/games/fortune/datfiles/fortunes2 +++ b/games/fortune/datfiles/fortunes2 @@ -2707,6 +2707,13 @@ audience, either." -- Reverse the bits in a word. % + n = (n & 0x55555555) + ((n & 0xaaaaaaaa) >> 1); + n = (n & 0x33333333) + ((n & 0xcccccccc) >> 2); + n = (n & 0x0f0f0f0f) + ((n & 0xf0f0f0f0) >> 4); + n = (n & 0x00ff00ff) + ((n & 0xff00ff00) >> 8); + n = (n & 0x0000ffff) + ((n & 0xffff0000) >> 16); +-- Count the bits in a word. +% Never ask your lover if he'd dive in front of an oncoming train for you. He doesn't know. Never ask your lover if she'd dive in front of an oncoming band of Hell's Angels for you. She doesn't know. Never ask how many |