* xxHash prototypes and implementation
*/
-#if defined (__cplusplus)
-extern "C" {
-#endif
-
/* ****************************
* INLINE mode
******************************/
/*! @brief Version number, encoded as two digits each */
#define XXH_VERSION_NUMBER (XXH_VERSION_MAJOR *100*100 + XXH_VERSION_MINOR *100 + XXH_VERSION_RELEASE)
+#if defined (__cplusplus)
+extern "C" {
+#endif
/*!
* @brief Obtains the xxHash version.
*
*/
XXH_PUBLIC_API XXH_CONSTF unsigned XXH_versionNumber (void);
+#if defined (__cplusplus)
+}
+#endif
/* ****************************
* Common basic types
# endif
#endif
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
/*!
* @}
*
#endif
/*! @endcond */
+#if defined (__cplusplus)
+} /* end of extern "C" */
+#endif
/*!
* @}
# endif
#endif
+#if defined (__cplusplus)
+extern "C" {
+#endif
/*!
* @}
*
#endif /* !XXH_NO_XXH3 */
+
+#if defined (__cplusplus)
+} /* extern "C" */
+#endif
+
#endif /* XXH_NO_LONG_LONG */
/*!
} while(0)
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
/*!
* @brief Calculates the 128-bit hash of @p data using XXH3.
*
XXH64_hash_t seed64);
#endif /* !XXH_NO_STREAM */
+#if defined (__cplusplus)
+} /* extern "C" */
+#endif
+
#endif /* !XXH_NO_XXH3 */
#endif /* XXH_NO_LONG_LONG */
+
#if defined(XXH_INLINE_ALL) || defined(XXH_PRIVATE_API)
# define XXH_IMPLEMENTATION
#endif
* @{
*/
-
/* *************************************
* Includes & Memory related functions
***************************************/
+#include <string.h> /* memcmp, memcpy */
+#include <limits.h> /* ULLONG_MAX */
+
#if defined(XXH_NO_STREAM)
/* nothing */
#elif defined(XXH_NO_STDLIB)
* without access to dynamic allocation.
*/
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
static XXH_CONSTF void* XXH_malloc(size_t s) { (void)s; return NULL; }
static void XXH_free(void* p) { (void)p; }
+#if defined (__cplusplus)
+} /* extern "C" */
+#endif
+
#else
/*
*/
#include <stdlib.h>
+#if defined (__cplusplus)
+extern "C" {
+#endif
/*!
* @internal
* @brief Modify this function to use a different routine than malloc().
*/
static void XXH_free(void* p) { free(p); }
-#endif /* XXH_NO_STDLIB */
+#if defined (__cplusplus)
+} /* extern "C" */
+#endif
-#include <string.h>
+#endif /* XXH_NO_STDLIB */
+#if defined (__cplusplus)
+extern "C" {
+#endif
/*!
* @internal
* @brief Modify this function to use a different routine than memcpy().
return memcpy(dest,src,size);
}
-#include <limits.h> /* ULLONG_MAX */
-
+#if defined (__cplusplus)
+} /* extern "C" */
+#endif
/* *************************************
* Compiler Specific Options
# define U32 xxh_u32
#endif
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
/* *** Memory access *** */
/*!
return XXH_readBE64(src);
}
+#if defined (__cplusplus)
+}
+#endif
+
#ifndef XXH_NO_XXH3
/* *********************************************************************
# pragma GCC optimize("-O2")
#endif
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
#if XXH_VECTOR == XXH_NEON
/*
# endif
#endif /* XXH_VECTOR == XXH_NEON */
+#if defined (__cplusplus)
+} /* extern "C" */
+#endif
+
/*
* VSX and Z Vector helpers.
*
# if defined(__POWER9_VECTOR__) || (defined(__clang__) && defined(__s390x__))
# define XXH_vec_revb vec_revb
# else
+#if defined (__cplusplus)
+extern "C" {
+#endif
/*!
* A polyfill for POWER9's vec_revb().
*/
0x0F, 0x0E, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08 };
return vec_perm(val, val, vByteSwap);
}
+#if defined (__cplusplus)
+} /* extern "C" */
+#endif
# endif
# endif /* XXH_VSX_BE */
+#if defined (__cplusplus)
+extern "C" {
+#endif
/*!
* Performs an unaligned vector load and byte swaps it on big endian.
*/
return result;
}
# endif /* XXH_vec_mulo, XXH_vec_mule */
+
+#if defined (__cplusplus)
+} /* extern "C" */
+#endif
+
#endif /* XXH_VECTOR == XXH_VSX */
#if XXH_VECTOR == XXH_SVE
# endif
#endif /* XXH_NO_PREFETCH */
-
+#if defined (__cplusplus)
+extern "C" {
+#endif
/* ==========================================
* XXH3 default settings
* ========================================== */
#endif /* !XXH_NO_STREAM */
/* 128-bit utility functions */
-#include <string.h> /* memcmp, memcpy */
-
/* return : 1 is equal, 0 if different */
/*! @ingroup XXH3_family */
XXH_PUBLIC_API int XXH128_isEqual(XXH128_hash_t h1, XXH128_hash_t h2)
#endif /* XXH_NO_LONG_LONG */
+#if defined (__cplusplus)
+} /* extern "C" */
+#endif
+
#endif /* XXH_NO_XXH3 */
/*!
* @}
*/
#endif /* XXH_IMPLEMENTATION */
-
-
-#if defined (__cplusplus)
-} /* extern "C" */
-#endif