diff options
| -rw-r--r-- | src/lib.rs | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -1,17 +1,21 @@ extern crate bchlib_sys as ffi; -pub fn init(m:i32, t:i32, poly: u32) { - unsafe { - let bch = ffi::init_bch(m, t, poly); +struct BCH(ffi::bch_control); + +impl BCH { + fn init(m: i32, t: i32, poly: u32) -> BCH { + let bch = unsafe { *ffi::init_bch(m, t, poly) }; + BCH(bch) } } + #[cfg(test)] mod tests { use super::*; #[test] fn it_works() { - init(); + let bch = BCH::init(5, 2, 0); } } |
