Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-17 08:54:11

0001 /*
0002  * SPDX-PackageName: "covfie, a part of the ACTS project"
0003  * SPDX-FileCopyrightText: 2022 CERN
0004  * SPDX-License-Identifier: MPL-2.0
0005  */
0006 
0007 #pragma once
0008 
0009 #include <type_traits>
0010 
0011 namespace covfie::utility {
0012 template <std::integral T>
0013 T round_pow2(T i)
0014 {
0015     T j = 1;
0016     for (; j < i; j *= 2)
0017         ;
0018     return j;
0019 }
0020 
0021 template <std::integral T>
0022 T ipow(T i, T p)
0023 {
0024     T r = 1;
0025 
0026     for (; p; p >>= 1) {
0027         if (p & 1) {
0028             r *= i;
0029         }
0030 
0031         i *= i;
0032     }
0033 
0034     return r;
0035 }
0036 }