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 bit_length(), purify_uint_bit_length_u64(), and PURIFY_UINT_WORDS.

Referenced by bit_length().

◆ 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 compare(), and PURIFY_UINT_WORDS.

Referenced by compare().

◆ 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 divmod_small(), purify_uint_divmod_u32(), and PURIFY_UINT_WORDS.

Referenced by divmod_small().

◆ from_bytes_be()

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

◆ 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 is_zero(), and PURIFY_UINT_WORDS.

Referenced by is_zero(), and purify::accountable::recover_same_slot_key().

◆ 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 mask_bits(), and PURIFY_UINT_WORDS.

Referenced by mask_bits().

◆ 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, PURIFY_UINT_WORDS, set_u64(), and set_zero().

Referenced by set_u64().

◆ 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, and set_zero().

Referenced by from_bytes_be(), set_u64(), set_zero(), 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, and shift_right_one().

Referenced by shift_right_one().

◆ 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, set_zero(), and shifted_left().

Referenced by shifted_left().

◆ 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, set_zero(), and shifted_right().

Referenced by shifted_right().

◆ 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, and to_bytes_be().

Referenced by to_bytes_be().

◆ 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, and try_add().

Referenced by try_add().

◆ 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, and try_add_small().

Referenced by from_bytes_be(), and try_add_small().

◆ try_mul_small()

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

◆ 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, and try_set_bit().

Referenced by try_set_bit().

◆ 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, and try_sub().

Referenced by try_sub().