Skip to content

Instantly share code, notes, and snippets.

impl<I> ModularArithmetic for I
where
I: Clone + Sized,
I: Zero + One + Neg<Output=I> + NumberTests,
for<'a> &'a I: Mul<I, Output=I>,
for<'a,'b> &'a I: Mul<&'b I, Output=I>,
for<'a,'b> &'a I: Div<&'b I, Output=I>,
for<'a> I: Rem<&'a I, Output=I>,
for<'a,'b> &'a I: Rem<&'b I, Output=I>,
for<'a,'b> &'a I: Add<&'b I, Output=I>,
#!/bin/sh
/Users/kali/dev/toolchains/raspbian/stretch/rpi-linaro/armv7-unknown-linux-gnueabihf/bin/armv7-unknown-linux-gnueabihf-gcc --sysroot /Users/kali/dev/toolchains/raspbian/stretch/rpi-linaro/armv7-unknown-linux-gnueabihf/armv7-unknown-linux-gnueabihf/sysroot "$@"
@kali
kali / dog.rs
Created February 13, 2019 19:32
extern crate flate2;
extern crate image;
extern crate ndarray;
extern crate protobuf;
extern crate tar;
#[allow(unused_imports)]
#[macro_use]
extern crate tract_core;
use std::{fs, io, path};
extern crate flate2;
extern crate image;
extern crate ndarray;
extern crate protobuf;
extern crate tar;
#[allow(unused_imports)]
#[macro_use]
extern crate tract_core;
use std::{fs, io, path};
pub fn spaced<I, O, E: nom::error::ParseError<I>, F>(
it: F,
) -> impl Fn(I) -> IResult<I, O, E> where
I: nom::InputTakeAtPosition,
<I as nom::InputTakeAtPosition>::Item: nom::AsChar + Clone,
F: Fn(I) -> IResult<I, O, E> {
delimited(space0, it, space0)
}
pub fn multispaced<I, O, E: nom::error::ParseError<I>, F>(
// should recognize:
// input-node name=foo dim=12
// i want to assume both are here, but not necessarily in this order
// i have similar case with more numrous foo=bar cases
fn parse_input_node_line(i: &str) -> IResult<&str, (String, usize)> {
use crate::parser::spaced;
use std::cell::Cell;
let name: Cell<Option<String>> = Cell::new(None);
let dim: Cell<Option<usize>> = Cell::new(None);
use std::arch::x86_64::*;
fn main() {
unsafe { run() }
}
#[target_feature(enable = "avx")]
unsafe fn run() {
let mut data:Vec<u8> = Vec::new();
for i in 0..32 {
pub fn integer<'a>(bin: bool) -> impl Fn(&'a [u8]) -> IResult<&'a [u8], i32> {
map(pair(
cond(bin, be_i32),
cond(!bin,
map_res(
map_res(
recognize(pair(opt(tag("-")), take_while(nom::character::is_digit))),
std::str::from_utf8,
),
|s| s.parse::<i32>(),
Running `/home/kali/dev/snips/tract/target/x86_64-unknown-linux-gnu/debug/tract -v /home/kali/.cache/hey_snips_v3.1.pb -i Sx40xf32 dump`
Uninitialized bytes in __interceptor_memchr at offset 0 inside [0x701000000000, 4)
==31975==WARNING: MemorySanitizer: use-of-uninitialized-value
#0 0x55ee6131f09e (/home/kali/dev/snips/tract/target/x86_64-unknown-linux-gnu/debug/tract+0x98f409e)
#1 0x55ee6132928e (/home/kali/dev/snips/tract/target/x86_64-unknown-linux-gnu/debug/tract+0x98fe28e)
#2 0x55ee57eee0fd (/home/kali/dev/snips/tract/target/x86_64-unknown-linux-gnu/debug/tract+0x4c30fd)
#3 0x55ee582a7141 (/home/kali/dev/snips/tract/target/x86_64-unknown-linux-gnu/debug/tract+0x87c141)
#4 0x7f0d89da909a (/lib/x86_64-linux-gnu/libc.so.6+0x2409a)
#5 0x55ee57c3f1e9 (/home/kali/dev/snips/tract/target/x86_64-unknown-linux-gnu/debug/tract+0x2141e9)
Uninitialized bytes in __interceptor_memchr at offset 0 inside [0x701000000000, 4)
==25215==WARNING: MemorySanitizer: use-of-uninitialized-value
#0 0x55d0ba4b4dcd (/home/kali/dev/snips/tract/target/x86_64-unknown-linux-gnu/release/tract+0xcefdcd)
#1 0x55d0ba4c2177 (/home/kali/dev/snips/tract/target/x86_64-unknown-linux-gnu/release/tract+0xcfd177)
#2 0x55d0ba679d7e (/home/kali/dev/snips/tract/target/x86_64-unknown-linux-gnu/release/tract+0xeb4d7e)
#3 0x7f7cb886409a (/lib/x86_64-linux-gnu/libc.so.6+0x2409a)
#4 0x55d0b9838289 (/home/kali/dev/snips/tract/target/x86_64-unknown-linux-gnu/release/tract+0x73289)