Function bsn1::contents::to_integer_unchecked[][src]

pub unsafe fn to_integer_unchecked<T>(bytes: &[u8]) -> T where
    T: PrimInt
Expand description

Parses bytes as a contents of Integer without any sanitization.

Type T should be the builtin primitive integer types (e.g., u8, u32, isize, i128, …)

This function is common for BER, DER, and CER.

Wargnings

This function assumes that the CPU adopts 2’s complement to represent negative value.

Safety

The behavior is undefined in the following cases.

  • bytes is not formatted as the contents of ANS.1 integer.
  • The result is too large or too small to be represented by type T .