purify
C++ Purify implementation with native circuit and BPP support
Loading...
Searching...
No Matches
uint_impl.h File Reference

Go to the source code of this file.

Functions

int PURIFY_UINT_FN() try_add_small (uint64_t value[PURIFY_UINT_WORDS], uint32_t addend)
 
int PURIFY_UINT_FN() try_mul_small (uint64_t value[PURIFY_UINT_WORDS], uint32_t factor)
 
void PURIFY_UINT_FN() set_zero (uint64_t out[PURIFY_UINT_WORDS])
 
void PURIFY_UINT_FN() set_u64 (uint64_t out[PURIFY_UINT_WORDS], uint64_t value)
 
void PURIFY_UINT_FN() from_bytes_be (uint64_t out[PURIFY_UINT_WORDS], const unsigned char *data, size_t size)
 
int PURIFY_UINT_FN() is_zero (const uint64_t value[PURIFY_UINT_WORDS])
 
int PURIFY_UINT_FN() compare (const uint64_t lhs[PURIFY_UINT_WORDS], const uint64_t rhs[PURIFY_UINT_WORDS])
 
int PURIFY_UINT_FN() try_add (uint64_t value[PURIFY_UINT_WORDS], const uint64_t addend[PURIFY_UINT_WORDS])
 
int PURIFY_UINT_FN() try_sub (uint64_t value[PURIFY_UINT_WORDS], const uint64_t subtrahend[PURIFY_UINT_WORDS])
 
size_t PURIFY_UINT_FN() bit_length (const uint64_t value[PURIFY_UINT_WORDS])
 
int PURIFY_UINT_FN() bit (const uint64_t value[PURIFY_UINT_WORDS], size_t index)
 
int PURIFY_UINT_FN() try_set_bit (uint64_t value[PURIFY_UINT_WORDS], size_t index)
 
void PURIFY_UINT_FN() shifted_left (uint64_t out[PURIFY_UINT_WORDS], const uint64_t value[PURIFY_UINT_WORDS], size_t bits)
 
void PURIFY_UINT_FN() shifted_right (uint64_t out[PURIFY_UINT_WORDS], const uint64_t value[PURIFY_UINT_WORDS], size_t bits)
 
void PURIFY_UINT_FN() shift_right_one (uint64_t value[PURIFY_UINT_WORDS])
 
void PURIFY_UINT_FN() mask_bits (uint64_t value[PURIFY_UINT_WORDS], size_t bits)
 
uint32_t PURIFY_UINT_FN() divmod_small (uint64_t value[PURIFY_UINT_WORDS], uint32_t divisor)
 
void PURIFY_UINT_FN() to_bytes_be (unsigned char out[PURIFY_UINT_WORDS *8], const uint64_t value[PURIFY_UINT_WORDS])
 

Function Documentation

◆ bit()

int PURIFY_UINT_FN() bit ( const uint64_t  value[PURIFY_UINT_WORDS],
size_t  index 
)

◆ bit_length()

size_t PURIFY_UINT_FN() bit_length ( const uint64_t  value[PURIFY_UINT_WORDS])

Definition at line 114 of file uint_impl.h.

References purify_uint_bit_length_u64(), and PURIFY_UINT_WORDS.

◆ compare()

int PURIFY_UINT_FN() compare ( const uint64_t  lhs[PURIFY_UINT_WORDS],
const uint64_t  rhs[PURIFY_UINT_WORDS] 
)

Definition at line 48 of file uint_impl.h.

References PURIFY_UINT_WORDS.

◆ divmod_small()

uint32_t PURIFY_UINT_FN() divmod_small ( uint64_t  value[PURIFY_UINT_WORDS],
uint32_t  divisor 
)

Definition at line 205 of file uint_impl.h.

References purify_uint_divmod_u32(), and PURIFY_UINT_WORDS.

◆ from_bytes_be()

void PURIFY_UINT_FN() from_bytes_be ( uint64_t  out[PURIFY_UINT_WORDS],
const unsigned char *  data,
size_t  size 
)

Definition at line 28 of file uint_impl.h.

References PURIFY_UINT_FN, set_zero(), try_add_small(), and try_mul_small().

◆ is_zero()

int PURIFY_UINT_FN() is_zero ( const uint64_t  value[PURIFY_UINT_WORDS])

Definition at line 38 of file uint_impl.h.

References PURIFY_UINT_WORDS.

◆ mask_bits()

void PURIFY_UINT_FN() mask_bits ( uint64_t  value[PURIFY_UINT_WORDS],
size_t  bits 
)

Definition at line 188 of file uint_impl.h.

References PURIFY_UINT_WORDS.

◆ set_u64()

void PURIFY_UINT_FN() set_u64 ( uint64_t  out[PURIFY_UINT_WORDS],
uint64_t  value 
)

Definition at line 23 of file uint_impl.h.

References PURIFY_UINT_FN, and set_zero().

◆ set_zero()

void PURIFY_UINT_FN() set_zero ( uint64_t  out[PURIFY_UINT_WORDS])

Definition at line 16 of file uint_impl.h.

References PURIFY_UINT_WORDS.

Referenced by from_bytes_be(), set_u64(), shifted_left(), and shifted_right().

◆ shift_right_one()

void PURIFY_UINT_FN() shift_right_one ( uint64_t  value[PURIFY_UINT_WORDS])

Definition at line 180 of file uint_impl.h.

References PURIFY_UINT_WORDS.

◆ shifted_left()

void PURIFY_UINT_FN() shifted_left ( uint64_t  out[PURIFY_UINT_WORDS],
const uint64_t  value[PURIFY_UINT_WORDS],
size_t  bits 
)

Definition at line 144 of file uint_impl.h.

References PURIFY_UINT_FN, PURIFY_UINT_WORDS, and set_zero().

◆ shifted_right()

void PURIFY_UINT_FN() shifted_right ( uint64_t  out[PURIFY_UINT_WORDS],
const uint64_t  value[PURIFY_UINT_WORDS],
size_t  bits 
)

Definition at line 163 of file uint_impl.h.

References PURIFY_UINT_FN, PURIFY_UINT_WORDS, and set_zero().

◆ to_bytes_be()

void PURIFY_UINT_FN() to_bytes_be ( unsigned char  out[PURIFY_UINT_WORDS *8],
const uint64_t  value[PURIFY_UINT_WORDS] 
)

Definition at line 219 of file uint_impl.h.

References PURIFY_UINT_WORDS.

◆ try_add()

int PURIFY_UINT_FN() try_add ( uint64_t  value[PURIFY_UINT_WORDS],
const uint64_t  addend[PURIFY_UINT_WORDS] 
)

Definition at line 86 of file uint_impl.h.

References PURIFY_UINT_WORDS.

◆ try_add_small()

int PURIFY_UINT_FN() try_add_small ( uint64_t  value[PURIFY_UINT_WORDS],
uint32_t  addend 
)

Definition at line 62 of file uint_impl.h.

References PURIFY_UINT_WORDS.

Referenced by from_bytes_be().

◆ try_mul_small()

int PURIFY_UINT_FN() try_mul_small ( uint64_t  value[PURIFY_UINT_WORDS],
uint32_t  factor 
)

Definition at line 73 of file uint_impl.h.

References purify_uint_add_u64_carry(), purify_uint_mul_u64(), and PURIFY_UINT_WORDS.

Referenced by from_bytes_be().

◆ try_set_bit()

int PURIFY_UINT_FN() try_set_bit ( uint64_t  value[PURIFY_UINT_WORDS],
size_t  index 
)

Definition at line 134 of file uint_impl.h.

References PURIFY_UINT_WORDS.

◆ try_sub()

int PURIFY_UINT_FN() try_sub ( uint64_t  value[PURIFY_UINT_WORDS],
const uint64_t  subtrahend[PURIFY_UINT_WORDS] 
)

Definition at line 100 of file uint_impl.h.

References PURIFY_UINT_WORDS.