gem5 v24.0.0.0
Loading...
Searching...
No Matches
intmath.hh File Reference
#include <cassert>
#include <cstdint>
#include <type_traits>
#include <utility>
#include "base/bitfield.hh"

Go to the source code of this file.

Namespaces

namespace  gem5
 Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
 

Functions

template<class T >
static constexpr std::enable_if_t< std::is_integral_v< T >, int > gem5::floorLog2 (T x)
 
template<class T >
static constexpr int gem5::ceilLog2 (const T &n)
 
template<class T >
static constexpr bool gem5::isPowerOf2 (const T &n)
 
template<class T , class U >
static constexpr T gem5::divCeil (const T &a, const U &b)
 
template<typename T >
static constexpr std::enable_if_t< sizeof(T)<=sizeof(uint32_t)> gem5::mulUnsigned (std::make_unsigned_t< T > &high, std::make_unsigned_t< T > &low, std::make_unsigned_t< T > val_a, std::make_unsigned_t< T > val_b)
 
template<typename T >
static constexpr std::enable_if_t< sizeof(T)<=sizeof(uint32_t)> gem5::mulSigned (std::make_signed_t< T > &high, std::make_signed_t< T > &low, std::make_signed_t< T > val_a, std::make_signed_t< T > val_b)
 
template<typename T >
static constexpr std::enable_if_t< sizeof(T)==sizeof(uint64_t)> gem5::mulUnsignedManual (std::make_unsigned_t< T > &high, std::make_unsigned_t< T > &low, std::make_unsigned_t< T > val_a, std::make_unsigned_t< T > val_b)
 Multiply two values with place value p.
 
template<typename T >
static constexpr std::enable_if_t< sizeof(T)==sizeof(uint64_t)> gem5::mulUnsigned (std::make_unsigned_t< T > &high, std::make_unsigned_t< T > &low, std::make_unsigned_t< T > val_a, std::make_unsigned_t< T > val_b)
 
template<typename T >
static constexpr std::enable_if_t< sizeof(T)==sizeof(uint64_t)> gem5::mulSignedManual (std::make_signed_t< T > &high, std::make_signed_t< T > &low, std::make_signed_t< T > val_a, std::make_signed_t< T > val_b)
 
template<typename T >
static constexpr std::enable_if_t< sizeof(T)==sizeof(uint64_t)> gem5::mulSigned (std::make_signed_t< T > &high, std::make_signed_t< T > &low, std::make_signed_t< T > val_a, std::make_signed_t< T > val_b)
 
template<typename T >
static constexpr std::pair< std::make_unsigned_t< T >, std::make_unsigned_t< T > > gem5::mulUnsigned (std::make_unsigned_t< T > val_a, std::make_unsigned_t< T > val_b)
 
template<typename T >
static constexpr std::pair< std::make_signed_t< T >, std::make_signed_t< T > > gem5::mulSigned (std::make_signed_t< T > val_a, std::make_signed_t< T > val_b)
 
template<class T , class U >
static constexpr T gem5::roundUp (const T &val, const U &align)
 This function is used to align addresses in memory.
 
template<class T , class U >
static constexpr T gem5::roundDown (const T &val, const U &align)
 This function is used to align addresses in memory.
 
static constexpr int gem5::log2i (int value)
 Calculate the log2 of a power of 2 integer.
 

Generated on Tue Jun 18 2024 16:24:08 for gem5 by doxygen 1.11.0