diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fe0f2a843d9162ee1a0c6263f18ec19438f43c6b..76a1007ad4c1d5a8bd1ebf369dd1ac08ee6723b1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -18,7 +18,7 @@ redox-nightly: - apt-key adv --keyserver keyserver.ubuntu.com --recv-keys AA12E97F0881517F - add-apt-repository 'deb https://static.redox-os.org/toolchain/apt /' - apt-get update -qq && apt-get install -qq x86-64-unknown-redox-gcc - - curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain nightly + - curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain nightly-2018-07-18 - source "$HOME/.cargo/env" - rustup target add x86_64-unknown-redox script: diff --git a/src/lib/lib.rs b/src/lib/lib.rs index 13e57505b55bafd9b377489e57e873b67fa90008..793ad0bac19ed0527011163dfe8a9438431c0e0a 100644 --- a/src/lib/lib.rs +++ b/src/lib/lib.rs @@ -1,7 +1,6 @@ #![allow(unknown_lints)] #![allow(while_let_on_iterator)] #![feature(nll)] -#![feature(stdsimd)] #[macro_use] extern crate bitflags; diff --git a/src/lib/shell/assignments.rs b/src/lib/shell/assignments.rs index fa751cec036cb93772f14110d699f9a958ab0cb3..57e1e34c00e5cd75e5c7f8eecdedf82b08881678 100644 --- a/src/lib/shell/assignments.rs +++ b/src/lib/shell/assignments.rs @@ -5,7 +5,6 @@ use itoa; use lexers::assignments::{Operator, Primitive}; use parser::assignments::*; use small; -use smallvec::SmallVec; use shell::{ history::ShellHistory, variables::VariableType @@ -14,7 +13,7 @@ use types; use std::{ collections::HashMap, env, ffi::OsStr, fmt::{self, Display}, io::{self, BufWriter, Write}, mem, - os::unix::ffi::OsStrExt, str, simd, + os::unix::ffi::OsStrExt, str }; fn list_vars(shell: &Shell) { @@ -295,7 +294,7 @@ impl VariableStore for Shell { } _ => (), } - match self.variables.get_ref(key.name) { + match self.variables.get_mut(key.name) { Some(VariableType::Str(lhs)) => { let result = math(&lhs, &key.kind, operator, &value, |value| { collected.insert(key.name, VariableType::Str(unsafe { @@ -309,8 +308,6 @@ impl VariableStore for Shell { } }, Some(VariableType::Array(array)) => { - let mut output = SmallVec::with_capacity(array.len()); - let value = match value.parse::<f64>() { Ok(n) => n, Err(_) => { @@ -319,36 +316,27 @@ impl VariableStore for Shell { } }; - for part in array.chunks(8) { - let mut vec = simd::f64x8::splat(0.0); - - for (i, value) in part.iter().enumerate() { - vec = vec.replace(i, match value.parse::<f64>() { - Ok(n) => n, - Err(_) => { - eprintln!("ion: assignment error: array item is not a float"); - return FAILURE; - } - }); + let action: Box<Fn(f64) -> f64> = match operator { + Operator::Add => Box::new(|src| src + value), + Operator::Divide => Box::new(|src| src / value), + Operator::Subtract => Box::new(|src| src - value), + Operator::Multiply => Box::new(|src| src * value), + _ => { + eprintln!("ion: assignment error: operator does not work on arrays"); + return FAILURE; } + }; - match operator { - Operator::Add => vec += value, - Operator::Divide => vec /= value, - Operator::Subtract => vec -= value, - Operator::Multiply => vec *= value, - _ => { - eprintln!("ion: assignment error: operator does not work on arrays"); + for element in array { + match element.parse::<f64>() { + Ok(number) => *element = action(number).to_string().into(), + Err(_) => { + eprintln!("ion: assignment error: {} is not a float", element); return FAILURE; } - } - for i in 0..part.len() { - output.push(vec.extract(i).to_string().into()); } } - - collected.insert(key.name, VariableType::Array(output)); }, _ => { eprintln!("ion: assignment error: type does not support this operator");