TurboPFor: Bit Pack/UnPack c/c++ header

This commit is contained in:
powturbo
2017-06-13 09:14:19 +02:00
parent 7714c4899f
commit 785a438ddd

View File

@ -24,13 +24,16 @@
// bitpack.h - "Integer Compression" Binary Packing header file // bitpack.h - "Integer Compression" Binary Packing header file
#ifndef BITPACK_H_ #ifndef BITPACK_H_
#define BITPACK_H_ #define BITPACK_H_
#if defined(_MSC_VER) && _MSC_VER < 1600
#include "vs/stdint.h"
#else
#include <stdint.h>
#endif
#include <stddef.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#include <stdint.h>
#include <stddef.h>
//******************** Bit Packing High Level API - n unlimited *************************************************** //******************** Bit Packing High Level API - n unlimited ***************************************************
size_t bitnpack8( uint8_t *__restrict in, size_t n, unsigned char *__restrict out); size_t bitnpack8( uint8_t *__restrict in, size_t n, unsigned char *__restrict out);
size_t bitnpack16( uint16_t *__restrict in, size_t n, unsigned char *__restrict out); size_t bitnpack16( uint16_t *__restrict in, size_t n, unsigned char *__restrict out);
@ -135,7 +138,7 @@ unsigned char *bitunpack64( const unsigned char *__restrict in, unsigned n, uint
// ---------------- Direct Access to a single packed integer array entry -------------------------------------------------------------- // ---------------- Direct Access to a single packed integer array entry --------------------------------------------------------------
#ifndef NTURBOPFOR_DAC #ifndef NTURBOPFOR_DAC
#if __AVX2__ #if defined(__AVX2__) && defined(AVX2_ON)
#include <immintrin.h> #include <immintrin.h>
#define bzhi64(_u_, _b_) _bzhi_u64(_u_, _b_) #define bzhi64(_u_, _b_) _bzhi_u64(_u_, _b_)
#define bzhi32(_u_, _b_) _bzhi_u32(_u_, _b_) #define bzhi32(_u_, _b_) _bzhi_u32(_u_, _b_)