Changeset View
Changeset View
Standalone View
Standalone View
contrib/zstd/lib/common/xxhash.c
Show First 20 Lines • Show All 91 Lines • ▼ Show 20 Lines | |||||
#endif | #endif | ||||
/* ************************************* | /* ************************************* | ||||
* Includes & Memory related functions | * Includes & Memory related functions | ||||
***************************************/ | ***************************************/ | ||||
/* Modify the local functions below should you wish to use some other memory routines */ | /* Modify the local functions below should you wish to use some other memory routines */ | ||||
/* for malloc(), free() */ | /* for malloc(), free() */ | ||||
#ifdef _KERNEL | |||||
#include "zstd_kmalloc.h" | |||||
#include <sys/param.h> | |||||
static void* XXH_malloc(size_t s) { return malloc(s, M_ZSTD, M_WAITOK); } | |||||
static void XXH_free (void* p) { free(p, M_ZSTD); } | |||||
/* for memcpy() */ | |||||
#include <sys/systm.h> | |||||
#else | |||||
#ifdef _BOOTSTRAP | |||||
#include <stand.h> | |||||
#else | |||||
#include <stdlib.h> | #include <stdlib.h> | ||||
static void* XXH_malloc(size_t s) { return malloc(s); } | |||||
static void XXH_free (void* p) { free(p); } | |||||
/* for memcpy() */ | /* for memcpy() */ | ||||
#include <string.h> | #include <string.h> | ||||
#endif /* _BOOTSTRAP */ | |||||
static void* XXH_malloc(size_t s) { return malloc(s); } | |||||
static void XXH_free (void* p) { free(p); } | |||||
#endif /* _KERNEL */ | |||||
static void* XXH_memcpy(void* dest, const void* src, size_t size) { return memcpy(dest,src,size); } | static void* XXH_memcpy(void* dest, const void* src, size_t size) { return memcpy(dest,src,size); } | ||||
#ifndef XXH_STATIC_LINKING_ONLY | #ifndef XXH_STATIC_LINKING_ONLY | ||||
# define XXH_STATIC_LINKING_ONLY | # define XXH_STATIC_LINKING_ONLY | ||||
#endif | #endif | ||||
#include "xxhash.h" | #include "xxhash.h" | ||||
Show All 23 Lines | |||||
/* ************************************* | /* ************************************* | ||||
* Basic Types | * Basic Types | ||||
***************************************/ | ***************************************/ | ||||
#ifndef MEM_MODULE | #ifndef MEM_MODULE | ||||
# define MEM_MODULE | # define MEM_MODULE | ||||
# if !defined (__VMS) && (defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) ) | # if !defined (__VMS) && (defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) ) | ||||
#ifndef _KERNEL | |||||
# include <stdint.h> | # include <stdint.h> | ||||
#endif | |||||
typedef uint8_t BYTE; | typedef uint8_t BYTE; | ||||
typedef uint16_t U16; | typedef uint16_t U16; | ||||
typedef uint32_t U32; | typedef uint32_t U32; | ||||
typedef int32_t S32; | typedef int32_t S32; | ||||
typedef uint64_t U64; | typedef uint64_t U64; | ||||
# else | # else | ||||
typedef unsigned char BYTE; | typedef unsigned char BYTE; | ||||
typedef unsigned short U16; | typedef unsigned short U16; | ||||
▲ Show 20 Lines • Show All 723 Lines • Show Last 20 Lines |