Storm 1.11.1.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
bitoperations.h File Reference
#include <array>
#include <bit>
#include <cstdint>
#include <ranges>
#include "storm/utility/macros.h"
Include dependency graph for bitoperations.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  storm
 
namespace  storm::utility
 

Functions

template<typename T >
storm::utility::byteSwap (T const t)
 Swaps the byte representation of the given value, (i.e., swaps endianness) Taken from https://en.cppreference.com/w/cpp/numeric/byteswap.
 
template<typename T , bool ReverseBytes = true>
storm::utility::reverseBits (T const t)
 Swaps the bits in the bit representation of the given value.
 
uint64_t smallestIntWithNBitsSet (uint64_t n)
 
uint64_t nextBitPermutation (uint64_t v)
 The next bit permutation in a lexicographical sense.
 

Function Documentation

◆ nextBitPermutation()

uint64_t nextBitPermutation ( uint64_t  v)
inline

The next bit permutation in a lexicographical sense.

Example: 00010011, 00010101, 00010110, 00011001, 00011010, 00011100, 00100011, and so forth

From https://graphics.stanford.edu/~seander/bithacks.html#NextBitPermutation

Definition at line 74 of file bitoperations.h.

◆ smallestIntWithNBitsSet()

uint64_t smallestIntWithNBitsSet ( uint64_t  n)
inline
Returns
2^n - 1

Definition at line 59 of file bitoperations.h.