Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Loading...
Searching...
No Matches
alignment.hh File Reference
#include "nix/util/error.hh"
#include <cassert>
#include <limits>
#include <type_traits>
#include <bit>

Go to the source code of this file.

Functions

template<typename T>
requires std::is_unsigned_v<T>
constexpr T nix::alignUp (T val, unsigned alignment)

Function Documentation

◆ alignUp()

template<typename T>
requires std::is_unsigned_v<T>
T nix::alignUp ( T val,
unsigned alignment )
constexpr

Aligns val upwards to be a multiple of alignment.

Precondition
alignment must be a power of 2.