summaryrefslogtreecommitdiffstats
path: root/common/quic.c
diff options
context:
space:
mode:
authorChristophe Fergeau <cfergeau@redhat.com>2011-04-22 12:55:21 +0200
committerChristophe Fergeau <cfergeau@redhat.com>2011-05-03 14:44:11 +0200
commit172edf298fa75fd85ed70751c81ec297e7ed0324 (patch)
tree67e975764876562b76ca71826bd1b6c18c37ae01 /common/quic.c
parentcdba4ead6764f8728ffcd2f4e67008185025a235 (diff)
downloadspice-172edf298fa75fd85ed70751c81ec297e7ed0324.tar.gz
spice-172edf298fa75fd85ed70751c81ec297e7ed0324.tar.xz
spice-172edf298fa75fd85ed70751c81ec297e7ed0324.zip
common: don't duplicate find_msb implementation
Diffstat (limited to 'common/quic.c')
-rw-r--r--common/quic.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/common/quic.c b/common/quic.c
index 8f8d7262..5a413990 100644
--- a/common/quic.c
+++ b/common/quic.c
@@ -25,6 +25,7 @@
#include "quic.h"
#include <spice/macros.h>
+#include "bitops.h"
//#define DEBUG
@@ -707,17 +708,6 @@ static int decode_channel_run(Encoder *encoder, Channel *channel)
#else
-static INLINE int find_msb(int x)
-{
- int r;
-
- __asm__("bsrl %1,%0\n\t"
- "jnz 1f\n\t"
- "movl $-1,%0\n"
- "1:" : "=r" (r) : "rm" (x));
- return r + 1;
-}
-
static INLINE void encode_run(Encoder *encoder, unsigned int len)
{
int odd = len & 1U;
@@ -725,7 +715,7 @@ static INLINE void encode_run(Encoder *encoder, unsigned int len)
len &= ~1U;
- while ((msb = find_msb(len))) {
+ while ((msb = spice_bit_find_msb(len))) {
len &= ~(1 << (msb - 1));
ASSERT(encoder->usr, msb < 32);
encode(encoder, (1 << (msb)) - 1, msb);