diff options
author | Bernhard Reutner-Fischer | 2006-05-26 13:13:11 +0000 |
---|---|---|
committer | Bernhard Reutner-Fischer | 2006-05-26 13:13:11 +0000 |
commit | 6d0dbeb55017985fa5d476b99427f7bf525e9a14 (patch) | |
tree | 19aaa311fcff895b2d4aad26b0c8eb77cf65b020 /archival/libunarchive/rangecoder.h | |
parent | e00fc16aaa0c1adb27bca40a9871b165c3ca3fb7 (diff) | |
download | busybox-6d0dbeb55017985fa5d476b99427f7bf525e9a14.zip busybox-6d0dbeb55017985fa5d476b99427f7bf525e9a14.tar.gz |
- use ATTRIBUTE_ALWAYS_INLINE if requested
- use shorter boilerplate while at it
Diffstat (limited to 'archival/libunarchive/rangecoder.h')
-rw-r--r-- | archival/libunarchive/rangecoder.h | 43 |
1 files changed, 6 insertions, 37 deletions
diff --git a/archival/libunarchive/rangecoder.h b/archival/libunarchive/rangecoder.h index 43f7522..e43ec39 100644 --- a/archival/libunarchive/rangecoder.h +++ b/archival/libunarchive/rangecoder.h @@ -1,39 +1,8 @@ -/* - * Small range coder implementation for lzma. - * Copyright (C) 2006 Aurelien Jacobs <aurel@gnuage.org> - * - * Based on LzmaDecode.c from the LZMA SDK 4.22 (http://www.7-zip.org/) - * Copyright (c) 1999-2005 Igor Pavlov - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include <stdint.h> #include "libbb.h" -#ifndef always_inline -# if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ >0) -# define always_inline __attribute__((always_inline)) inline -# else -# define always_inline inline -# endif -#endif - #ifdef CONFIG_FEATURE_LZMA_FAST -# define speed_inline always_inline +# define speed_inline ATTRIBUTE_ALWAYS_INLINE #else # define speed_inline #endif @@ -67,7 +36,7 @@ static void rc_read(rc_t * rc) } /* Called once */ -static always_inline void rc_init(rc_t * rc, int fd, int buffer_size) +static ATTRIBUTE_ALWAYS_INLINE void rc_init(rc_t * rc, int fd, int buffer_size) { int i; @@ -87,7 +56,7 @@ static always_inline void rc_init(rc_t * rc, int fd, int buffer_size) } /* Called once. TODO: bb_maybe_free() */ -static always_inline void rc_free(rc_t * rc) +static ATTRIBUTE_ALWAYS_INLINE void rc_free(rc_t * rc) { if (ENABLE_FEATURE_CLEAN_UP) free(rc->buffer); @@ -101,7 +70,7 @@ static void rc_do_normalize(rc_t * rc) rc->range <<= 8; rc->code = (rc->code << 8) | *rc->ptr++; } -static always_inline void rc_normalize(rc_t * rc) +static ATTRIBUTE_ALWAYS_INLINE void rc_normalize(rc_t * rc) { if (rc->range < (1 << RC_TOP_BITS)) { rc_do_normalize(rc); @@ -118,7 +87,7 @@ static speed_inline uint32_t rc_is_bit_0_helper(rc_t * rc, uint16_t * p) rc->bound = *p * (rc->range >> RC_MODEL_TOTAL_BITS); return rc->bound; } -static always_inline int rc_is_bit_0(rc_t * rc, uint16_t * p) +static ATTRIBUTE_ALWAYS_INLINE int rc_is_bit_0(rc_t * rc, uint16_t * p) { uint32_t t = rc_is_bit_0_helper(rc, p); return rc->code < t; @@ -152,7 +121,7 @@ static int rc_get_bit(rc_t * rc, uint16_t * p, int *symbol) } /* Called once */ -static always_inline int rc_direct_bit(rc_t * rc) +static ATTRIBUTE_ALWAYS_INLINE int rc_direct_bit(rc_t * rc) { rc_normalize(rc); rc->range >>= 1; |