Botan 3.6.0
Crypto and TLS for C&
Botan::SolinasAccum< W, N > Class Template Reference

#include <pcurves_solinas.h>

Public Member Functions

constexpr void accum (int64_t v)
 
constexpr W final_carry (int64_t C)
 
constexpr SolinasAccum (std::array< W, N > &r)
 

Static Public Attributes

static constexpr size_t N32 = N * (WordInfo<W>::bits / 32)
 

Detailed Description

template<WordType W, size_t N>
class Botan::SolinasAccum< W, N >

Definition at line 44 of file pcurves_solinas.h.

Constructor & Destructor Documentation

◆ SolinasAccum()

template<WordType W, size_t N>
Botan::SolinasAccum< W, N >::SolinasAccum ( std::array< W, N > & r)
inlineconstexpr

Definition at line 50 of file pcurves_solinas.h.

50: m_r(r), m_S(0), m_idx(0) {}

Member Function Documentation

◆ accum()

template<WordType W, size_t N>
void Botan::SolinasAccum< W, N >::accum ( int64_t v)
inlineconstexpr

Definition at line 52 of file pcurves_solinas.h.

52 {
53 BOTAN_DEBUG_ASSERT(m_idx < N32);
54
55 m_S += v;
56 const uint32_t r = static_cast<uint32_t>(m_S);
57 m_S >>= 32;
58
59 if constexpr(WordInfo<W>::bits == 32) {
60 m_r[m_idx] = r;
61 } else {
62 m_r[m_idx / 2] |= static_cast<uint64_t>(r) << (32 * (m_idx % 2));
63 }
64
65 m_idx += 1;
66 }
#define BOTAN_DEBUG_ASSERT(expr)
Definition assert.h:98
static constexpr size_t N32

References BOTAN_DEBUG_ASSERT, and Botan::SolinasAccum< W, N >::N32.

◆ final_carry()

template<WordType W, size_t N>
W Botan::SolinasAccum< W, N >::final_carry ( int64_t C)
inlineconstexpr

Definition at line 68 of file pcurves_solinas.h.

68 {
69 m_S += C;
70 BOTAN_DEBUG_ASSERT(m_S >= 0);
71 return static_cast<W>(m_S);
72 }

References BOTAN_DEBUG_ASSERT.

Member Data Documentation

◆ N32

template<WordType W, size_t N>
size_t Botan::SolinasAccum< W, N >::N32 = N * (WordInfo<W>::bits / 32)
staticconstexpr

Definition at line 48 of file pcurves_solinas.h.

Referenced by Botan::SolinasAccum< W, N >::accum().


The documentation for this class was generated from the following file: