aboutsummaryrefslogtreecommitdiff
path: root/src/liblzma/common/bsr.h
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2009-11-22 11:55:03 +0200
committerLasse Collin <lasse.collin@tukaani.org>2009-11-22 11:55:03 +0200
commit0733f4c9994db696420a405810d5f02c79ebc404 (patch)
tree467ab8c4b568c12c597eb8792836745f2a085300 /src/liblzma/common/bsr.h
parentUpdate tuklib_integer.h with bit scan functions. (diff)
downloadxz-0733f4c9994db696420a405810d5f02c79ebc404.tar.xz
Make fastpos.h use tuklib_integer.h instead of bsr.h
when --enable-small has been specified.
Diffstat (limited to 'src/liblzma/common/bsr.h')
-rw-r--r--src/liblzma/common/bsr.h60
1 files changed, 0 insertions, 60 deletions
diff --git a/src/liblzma/common/bsr.h b/src/liblzma/common/bsr.h
deleted file mode 100644
index bef8641f..00000000
--- a/src/liblzma/common/bsr.h
+++ /dev/null
@@ -1,60 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-//
-/// \file bsr.h
-/// \brief Bit scan reverse
-//
-// Author: Lasse Collin
-//
-// This file has been put into the public domain.
-// You can do whatever you want with this file.
-//
-///////////////////////////////////////////////////////////////////////////////
-
-#ifndef LZMA_BSR_H
-#define LZMA_BSR_H
-
-// NOTE: Both input and output variables for lzma_bsr must be uint32_t.
-
-#if defined(__GNUC__) && (defined (HAVE_ASM_X86) || defined(HAVE_ASM_X86_64))
-# define lzma_bsr(dest, n) \
- __asm__("bsrl %1, %0" : "=r" (dest) : "rm" (n))
-
-#else
-# define lzma_bsr(dest, n) dest = lzma_bsr_helper(n)
-
-static inline uint32_t
-lzma_bsr_helper(uint32_t n)
-{
- assert(n != 0);
-
- uint32_t i = 31;
-
- if ((n & UINT32_C(0xFFFF0000)) == 0) {
- n <<= 16;
- i = 15;
- }
-
- if ((n & UINT32_C(0xFF000000)) == 0) {
- n <<= 8;
- i -= 8;
- }
-
- if ((n & UINT32_C(0xF0000000)) == 0) {
- n <<= 4;
- i -= 4;
- }
-
- if ((n & UINT32_C(0xC0000000)) == 0) {
- n <<= 2;
- i -= 2;
- }
-
- if ((n & UINT32_C(0x80000000)) == 0)
- --i;
-
- return i;
-}
-
-#endif
-
-#endif