diff options
| author | Yuval Adam <_@yuv.al> | 2019-03-18 16:58:28 +0200 |
|---|---|---|
| committer | Yuval Adam <_@yuv.al> | 2019-03-18 16:58:28 +0200 |
| commit | fa17f132e23118dd88f4726613e8722c8a38f464 (patch) | |
| tree | 8e3a0191517bb462d693ffc4387b847461abe243 /src | |
| parent | 4e5cac1c627648fd8ade50024490d541d0c6bf93 (diff) | |
Prepare for naive decoding implementation
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib.rs | 20 |
1 files changed, 15 insertions, 5 deletions
@@ -1,8 +1,17 @@ -extern crate bchlib_sys as ffi; -pub fn init(m:i32, t:i32, poly: u32) { - unsafe { - let bch = ffi::init_bch(m, t, poly); +pub struct BCH { + n: u32, +} + +impl BCH { + pub fn new(n: u32) -> BCH { + BCH { + n + } + } + + pub fn decode(self) -> u32{ + return self.n } } @@ -12,6 +21,7 @@ mod tests { #[test] fn it_works() { - init(); + let bch = BCH::new(3); + assert_eq!(bch.decode(), 3); } } |
