summaryrefslogtreecommitdiff
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
parent4e5cac1c627648fd8ade50024490d541d0c6bf93 (diff)
Prepare for naive decoding implementation
-rw-r--r--Cargo.toml1
-rw-r--r--src/lib.rs20
2 files changed, 15 insertions, 6 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 73f3293..19ded13 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -5,4 +5,3 @@ authors = ["Yuval Adam <_@yuv.al>"]
edition = "2018"
[dependencies]
-bchlib-sys = "0.1.0"
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);
}
}