non-native make

pull/1/head
Avril 4 years ago
parent c24f5fb717
commit 4f4095de4e
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -2,11 +2,16 @@ INSTALL:= /usr/local/lib
INSTALL-BIN:= /usr/local/bin INSTALL-BIN:= /usr/local/bin
CLI:= cli CLI:= cli
khash: khash:
RUSTFLAGS="-C target-cpu=native" cargo build --release RUSTFLAGS="-C target-cpu=native" cargo build --release
strip ./target/release/libkhash.so strip ./target/release/libkhash.so
cd $(CLI) && $(MAKE) kana-hash cd $(CLI) && $(MAKE) kana-hash
khash-nonative:
cargo build --release
cd $(CLI) && $(MAKE) kana-hash
test: test:
cargo test cargo test
cd $(CLI) && $(MAKE) cd $(CLI) && $(MAKE)

@ -17,13 +17,13 @@ impl Digest {
{ {
let mut d = Self::default(); let mut d = Self::default();
let master = usize::from(from[0]) % map::KANA.len(); let oneesan = usize::from(from[0]) % map::KANA.len();
d.0 = Some(map::KANA[master]); d.0 = Some(map::KANA[oneesan]);
if from[1] > 0 { if from[1] > 0 {
if let Some(slaves) = map::sub(master) { if let Some(imoutos) = map::sub(oneesan) {
let one = (usize::from(from[1]) / map::KANA.len()) % 2; let one = (usize::from(from[1]) / map::KANA.len()) % 2;
if slaves.len() > 0 && one > 0{ if imoutos.len() > 0 && one > 0{
d.1 = Some(slaves[usize::from(from[1]) % slaves.len()]); d.1 = Some(imoutos[usize::from(from[1]) % imoutos.len()]);
return d; return d;
} }
} }
@ -31,10 +31,10 @@ impl Digest {
d.1 = Self::new(&from[..]).0; d.1 = Self::new(&from[..]).0;
} }
d d
/*let master = usize::from(from) % map::KANA.len(); /*let oneesan = usize::from(from) % map::KANA.len();
d.0 = Some(map::KANA[master]); d.0 = Some(map::KANA[oneesan]);
if let Some(slaves) = map::sub(master) { if let Some(imoutos) = map::sub(oneesan) {
if slaves.len() > 0 { if imoutos.len() > 0 {
} }
} else { } else {
@ -49,11 +49,11 @@ impl fmt::Display for Digest
{ {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result
{ {
if let Some(master) = self.0 { if let Some(oneesan) = self.0 {
write!(f, "{}", master)?; write!(f, "{}", oneesan)?;
} }
if let Some(slave) = self.1 { if let Some(imouto) = self.1 {
write!(f, "{}", slave)?; write!(f, "{}", imouto)?;
} }
Ok(()) Ok(())
} }

Loading…
Cancel
Save