Program Listing for File Bitwise.h

↰ Return to documentation for file (ADS/combinatorial/Bitwise.h)

/*--------------------------------------------------------------------------*/
/*----------------------------- File Bitwise.h -----------------------------*/
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
/*----------------------------- DEFINITIONS --------------------------------*/
/*--------------------------------------------------------------------------*/

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

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

#include "ADS/Contract.h"

#include <cstdint>
#include <utility>

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

namespace ADS {

using Word = std::uint64_t;

[[nodiscard]] constexpr int sidewaysSum( Word x );

[[nodiscard]] constexpr int ruler( Word x );

[[nodiscard]] constexpr int lambda( Word x );

[[nodiscard]] constexpr Word rightmostOne( Word x );

[[nodiscard]] constexpr Word smearRight( Word x );

[[nodiscard]] constexpr Word reverseBits( Word x );

[[nodiscard]] constexpr Word gray( Word x );

[[nodiscard]] constexpr Word grayInverse( Word g );

[[nodiscard]] constexpr Word nextSameWeight( Word x );

[[nodiscard]] constexpr Word interleave( std::uint32_t x , std::uint32_t y );

[[nodiscard]] constexpr std::pair< std::uint32_t , std::uint32_t >
deinterleave( Word z );

[[nodiscard]] constexpr bool hasZeroByte( Word x );

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

}  // end( namespace ADS )

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

#include "ADS/combinatorial/impl/Bitwise.tpp"

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

#endif  /* Bitwise.h included */

/*--------------------------------------------------------------------------*/
/*--------------------------- End File Bitwise.h ---------------------------*/
/*--------------------------------------------------------------------------*/