diff options
author | Guy Harris <guy@alum.mit.edu> | 2018-03-13 15:28:35 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2018-03-13 22:29:27 +0000 |
commit | 068dbc809f3f1e18f99cff517dbf07d0c1387d91 (patch) | |
tree | 55b97862d6ffb5d6d9a17d27d611649bc59edd5c /wsutil/bits_count_ones.h | |
parent | 0f45f4bcf76134ff583ef899b132fae5fb315dae (diff) |
Expand a comment.
Change-Id: I154bce4901929c5f3eafa88cae2cd4ce53b28326
Reviewed-on: https://code.wireshark.org/review/26466
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'wsutil/bits_count_ones.h')
-rw-r--r-- | wsutil/bits_count_ones.h | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/wsutil/bits_count_ones.h b/wsutil/bits_count_ones.h index 2e532e93b0..0055d122e8 100644 --- a/wsutil/bits_count_ones.h +++ b/wsutil/bits_count_ones.h @@ -15,10 +15,26 @@ /* * The variable-precision SWAR algorithm is an interesting way to count - * the number of bits set in an integer. While its performance is very - * good (two times faster than gcc's __builtin_popcount [1] and - * 16 instructions when compiled with gcc -O3) - * http://playingwithpointers.com/swar.html + * the number of bits set in an integer: + * + * http://playingwithpointers.com/swar.html + * + * See + * + * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36041 + * https://danluu.com/assembly-intrinsics/ + * + * for discussions of various forms of population-counting code on x86. + * + * See + * + * https://msdn.microsoft.com/en-us/library/bb385231.aspx + * + * for MSVC's population count intrinsics. + * + * Note that not all x86 processors support the POPCOUNT instruction. + * + * Other CPUs may have population count instructions as well. */ static inline int |