[][src]Module ramp::ll::base

Base conversion utilities

Provides functions for converting an integer to/from a given base. In both to_base and from_base the base-N output or input (respectively) is stored as raw bytes. That means that a base-10 input contains bytes each with a value from 0-9.

Functions

base_digits_to_len
from_base

Converts the base base bytestring {bp, bs}, storing the limbs in out. out is assumed to have enough space to store the result.

num_base_digits

Returns the number of digits needed to represent p in base base without sign. If the base is not a power of two, the result is only an estimate. It can equal the the actually needed digits or overestimate by 1. Returns 1 if the number is 0;

to_base

Converts nn limbs at np to the given base, storing the output in out. out is assumed to have enough space for the entire digit. The output is stored from most-significant digit to least.