Program Listing for File BinaryPacking.h

↰ Return to documentation for file (ADS/compression/BinaryPacking.h)

/*--------------------------------------------------------------------------*/
/*-------------------------- File BinaryPacking.h --------------------------*/
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
/*----------------------------- DEFINITIONS --------------------------------*/
/*--------------------------------------------------------------------------*/

#ifndef __ADS_BinaryPacking
 #define __ADS_BinaryPacking
                      /* self-identification: #endif constant */

/*--------------------------------------------------------------------------*/
/*------------------------------ INCLUDES ----------------------------------*/
/*--------------------------------------------------------------------------*/

#include "ADS/Contract.h"

#include <algorithm>
#include <array>
#include <bit>
#include <cstddef>
#include <cstdint>
#include <cstring>
#include <span>
#include <utility>
#include <vector>

#if ( defined( __SSE2__ ) || defined( _M_X64 ) ) && \
    ! defined( ADS_BP_SCALAR )
 #include <emmintrin.h>
 #define ADS_BP_SSE 1
#endif

/*--------------------------------------------------------------------------*/
/*--------------------------- NAMESPACE ------------------------------------*/
/*--------------------------------------------------------------------------*/

namespace ADS {

[[nodiscard]] inline std::vector< std::uint8_t > binaryPack(
                         std::span< const std::uint32_t > x ,
                         bool sorted = false );

[[nodiscard]] inline std::vector< std::uint32_t > binaryUnpack(
                         std::span< const std::uint8_t > in , std::size_t n ,
                         bool sorted = false );

[[nodiscard]] inline std::vector< std::uint8_t > patchedPack(
                         std::span< const std::uint32_t > x ,
                         bool sorted = false );

[[nodiscard]] inline std::vector< std::uint32_t > patchedUnpack(
                         std::span< const std::uint8_t > in , std::size_t n ,
                         bool sorted = false );

/*--------------------------------------------------------------------------*/

}  // end( namespace ADS )

/*--------------------------------------------------------------------------*/
/*-------------------------- IMPLEMENTATION --------------------------------*/
/*--------------------------------------------------------------------------*/

#include "ADS/compression/impl/BinaryPacking.tpp"

/*--------------------------------------------------------------------------*/

#endif  /* BinaryPacking.h included */

/*--------------------------------------------------------------------------*/
/*------------------------ End File BinaryPacking.h ------------------------*/
/*--------------------------------------------------------------------------*/