diff options
author | Stephen Fisher <sfisher@sdf.org> | 2014-12-22 13:50:10 -0700 |
---|---|---|
committer | Stephen Fisher <sfisher@sdf.org> | 2014-12-23 00:22:23 +0000 |
commit | 3d62d2c396aa016d97f788205978f4fdba2d4d4b (patch) | |
tree | 161f97d511c7449b0caf17ab87edef4b0280a573 /epan/dissectors/packet-x11.c | |
parent | 59b4ab53fcf08db3daa7461b463ca47e83e55079 (diff) |
Move popcount() to an optionally built part of wsutil for systems that
provide their own popcount().
Change-Id: Ic26f3b50cf0bd2b4af0d42e9c27488ebbac1ab33
Reviewed-on: https://code.wireshark.org/review/5998
Petri-Dish: Stephen Fisher <sfisher@sdf.org>
Reviewed-by: Stephen Fisher <sfisher@sdf.org>
Diffstat (limited to 'epan/dissectors/packet-x11.c')
-rw-r--r-- | epan/dissectors/packet-x11.c | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/epan/dissectors/packet-x11.c b/epan/dissectors/packet-x11.c index b4950ea2cf..6edcde7d21 100644 --- a/epan/dissectors/packet-x11.c +++ b/epan/dissectors/packet-x11.c @@ -61,6 +61,10 @@ #include "packet-x11-keysymdef.h" #include "packet-x11.h" +#ifndef HAVE_POPCOUNT +# include "wsutil/popcount.h" +#endif + void proto_register_x11(void); void proto_reg_handoff_x11(void); @@ -3203,21 +3207,6 @@ static void set_handler(const char *name, void (*func)(tvbuff_t *tvb, packet_inf g_hash_table_insert(reply_table, (gpointer)name, (gpointer)reply_info); } -static int popcount(unsigned int mask) -{ -#if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) - /* GCC 3.4 or newer */ - return __builtin_popcount(mask); -#else - /* HACKMEM 169 */ - unsigned long y; - - y = (mask >> 1) &033333333333; - y = mask - y - ((y >>1) & 033333333333); - return (((y + (y >> 3)) & 030707070707) % 077); -#endif -} - #include "x11-extension-errors.h" #include "x11-extension-implementation.h" |