inside-baseball 0.1.0

Modding tools for Backyard Baseball 2001
Documentation
1
2
3
4
5
6
7
8
9
10
use std::ops::Range;

pub mod byte_array;

pub fn subslice_offset(this: &[u8], other: &[u8]) -> usize {
    let Range { start, end } = this.as_ptr_range();
    assert!(start <= other.as_ptr() && other.as_ptr() <= end);
    let result = unsafe { other.as_ptr().offset_from(start) };
    result.try_into().unwrap()
}