mirror of
https://github.com/webmproject/libwebp.git
synced 2024-11-20 04:18:26 +01:00
Add WEBP_RESTRICT & use it in VP8BitReader
Marking the `VP8BitReader` as `__restrict__` helps the compiler generate better code avoiding issues related to aliasing (re-loads/stores). Change-Id: Ib7178f57e27e5f40572efc3e567cdf994ea6d928
This commit is contained in:
parent
f6d2924757
commit
3e26513656
@ -104,7 +104,7 @@ void VP8LoadNewBytes(VP8BitReader* const br) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Read a bit with proba 'prob'. Speed-critical function!
|
// Read a bit with proba 'prob'. Speed-critical function!
|
||||||
static WEBP_INLINE int VP8GetBit(VP8BitReader* const br,
|
static WEBP_INLINE int VP8GetBit(VP8BitReader* WEBP_RESTRICT const br,
|
||||||
int prob, const char label[]) {
|
int prob, const char label[]) {
|
||||||
// Don't move this declaration! It makes a big speed difference to store
|
// Don't move this declaration! It makes a big speed difference to store
|
||||||
// 'range' *before* calling VP8LoadNewBytes(), even if this function doesn't
|
// 'range' *before* calling VP8LoadNewBytes(), even if this function doesn't
|
||||||
|
@ -25,6 +25,16 @@
|
|||||||
#include "src/dsp/dsp.h"
|
#include "src/dsp/dsp.h"
|
||||||
#include "src/webp/types.h"
|
#include "src/webp/types.h"
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// restrict
|
||||||
|
|
||||||
|
#if defined(__GNUC__) || defined(__clang__)
|
||||||
|
#define WEBP_RESTRICT __restrict
|
||||||
|
#else
|
||||||
|
#define WEBP_RESTRICT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user