mirror of https://github.com/google/snappy.git
Introduce SNAPPY_ATTRIBUTE_ALWAYS_INLINE.
An internal CL started using ABSL_ATTRIBUTE_ALWAYS_INLINE from Abseil. This CL introduces equivalent functionality as SNAPPY_ALWAYS_INLINE. PiperOrigin-RevId: 306289650
This commit is contained in:
parent
231b8be076
commit
a4cdb5d133
|
@ -103,6 +103,13 @@ int main() {
|
||||||
return __builtin_ctzll(0);
|
return __builtin_ctzll(0);
|
||||||
}" HAVE_BUILTIN_CTZ)
|
}" HAVE_BUILTIN_CTZ)
|
||||||
|
|
||||||
|
check_cxx_source_compiles("
|
||||||
|
__attribute__((always_inline)) int zero() { return 0; }
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
return zero();
|
||||||
|
}" HAVE_ATTRIBUTE_ALWAYS_INLINE)
|
||||||
|
|
||||||
check_cxx_source_compiles("
|
check_cxx_source_compiles("
|
||||||
#include <tmmintrin.h>
|
#include <tmmintrin.h>
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
#ifndef THIRD_PARTY_SNAPPY_OPENSOURCE_CMAKE_CONFIG_H_
|
#ifndef THIRD_PARTY_SNAPPY_OPENSOURCE_CMAKE_CONFIG_H_
|
||||||
#define THIRD_PARTY_SNAPPY_OPENSOURCE_CMAKE_CONFIG_H_
|
#define THIRD_PARTY_SNAPPY_OPENSOURCE_CMAKE_CONFIG_H_
|
||||||
|
|
||||||
|
/* Define to 1 if the compiler supports __attribute__((always_inline)). */
|
||||||
|
#cmakedefine HAVE_ATTRIBUTE_ALWAYS_INLINE 1
|
||||||
|
|
||||||
/* Define to 1 if the compiler supports __builtin_ctz and friends. */
|
/* Define to 1 if the compiler supports __builtin_ctz and friends. */
|
||||||
#cmakedefine HAVE_BUILTIN_CTZ 1
|
#cmakedefine HAVE_BUILTIN_CTZ 1
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <numeric_limits>
|
#include <limits>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
@ -107,6 +107,13 @@
|
||||||
#define SNAPPY_PREDICT_TRUE(x) x
|
#define SNAPPY_PREDICT_TRUE(x) x
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Inlining hints.
|
||||||
|
#ifdef HAVE_ATTRIBUTE_ALWAYS_INLINE
|
||||||
|
#define SNAPPY_ATTRIBUTE_ALWAYS_INLINE __attribute__((always_inline))
|
||||||
|
#else
|
||||||
|
#define SNAPPY_ATTRIBUTE_ALWAYS_INLINE
|
||||||
|
#endif
|
||||||
|
|
||||||
// This is only used for recomputing the tag byte table used during
|
// This is only used for recomputing the tag byte table used during
|
||||||
// decompression; for simplicity we just remove it from the open-source
|
// decompression; for simplicity we just remove it from the open-source
|
||||||
// version (anyone who wants to regenerate it can just do the call
|
// version (anyone who wants to regenerate it can just do the call
|
||||||
|
|
|
@ -1358,7 +1358,7 @@ class SnappyArrayWriter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ABSL_ATTRIBUTE_ALWAYS_INLINE
|
SNAPPY_ATTRIBUTE_ALWAYS_INLINE
|
||||||
inline bool AppendFromSelf(size_t offset, size_t len, char** op_p) {
|
inline bool AppendFromSelf(size_t offset, size_t len, char** op_p) {
|
||||||
char* const op = *op_p;
|
char* const op = *op_p;
|
||||||
char* const op_end = op + len;
|
char* const op_end = op + len;
|
||||||
|
|
Loading…
Reference in New Issue