nonstdfloat 0.1.1

Floating point calculations for strafe
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use bitvec::{prelude::*, vec::BitVec};

use crate::{signed::SignedIntegerExtendable, unsigned::UnsignedIntegerExtendable};

#[derive(Clone, Debug)]
pub struct DecimalExtendable(pub(crate) BitVec, usize);

impl DecimalExtendable {
    pub fn from_signed(s: SignedIntegerExtendable) -> Self {
        Self(s.0, 0)
    }

    pub fn from_unsigned(u: UnsignedIntegerExtendable) -> Self {
        let mut bits = u.0;
        bits.insert(0, false);
        Self(bits, 0)
    }
}