osiris-data 0.2.1

A data management package.
Documentation
use crate::data::atomic::{HalfWord, Word};

#[test]
fn split_word_into_halfwords() {
    let word = Word::new(0x00FF00FF00FF00FF);
    assert_eq!(word.to_u64(), 0x00FF00FF00FF00FF);
    let [top, bottom] = word.split();
    assert_eq!(top.to_u32(), 0x00FF00FF);
    assert_eq!(top.to_u64(), 0x00FF00FF);
    assert_eq!(bottom.to_u32(), 0x00FF00FF);
    assert_eq!(bottom.to_u64(), 0x00FF00FF);
    assert_eq!(top, bottom);
}

#[test]
fn merge_halfwords_into_word() {
    let top = HalfWord::new(0x00FF00FF);
    let bottom = HalfWord::new(0x00FF00FF);
    assert_eq!(top.to_u32(), 0x00FF00FF);
    assert_eq!(top.to_u64(), 0x00FF00FF);
    assert_eq!(bottom.to_u32(), 0x00FF00FF);
    assert_eq!(bottom.to_u64(), 0x00FF00FF);
    assert_eq!(top, bottom);
    let word = top.with(bottom);
    assert_eq!(word.to_u64(), 0x00FF00FF00FF00FF);
}