summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYuval Adam <_@yuv.al>2019-03-18 16:58:28 +0200
committerYuval Adam <_@yuv.al>2019-03-18 16:58:28 +0200
commitfa17f132e23118dd88f4726613e8722c8a38f464 (patch)
tree8e3a0191517bb462d693ffc4387b847461abe243 /src
parent4e5cac1c627648fd8ade50024490d541d0c6bf93 (diff)
Prepare for naive decoding implementation
Diffstat (limited to 'src')
-rw-r--r--src/lib.rs20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 0af03a6..2f49852 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -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);
}
}