mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Use std::simd instead of the simd crate
This commit is contained in:
parent
62c37e00ab
commit
266cb29788
5 changed files with 10 additions and 20 deletions
7
Cargo.lock
generated
7
Cargo.lock
generated
|
@ -1011,7 +1011,6 @@ dependencies = [
|
|||
"servo_arc 0.1.1",
|
||||
"servo_atoms 0.0.1",
|
||||
"servo_url 0.0.1",
|
||||
"simd 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"smallvec 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"style 0.0.1",
|
||||
"time 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -2894,11 +2893,6 @@ name = "signpost"
|
|||
version = "0.1.0"
|
||||
source = "git+https://github.com/pcwalton/signpost.git#7ed712507f343c38646b9d1fefd049166f9c9a18"
|
||||
|
||||
[[package]]
|
||||
name = "simd"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "siphasher"
|
||||
version = "0.2.2"
|
||||
|
@ -3944,7 +3938,6 @@ dependencies = [
|
|||
"checksum shared_library 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8254bf098ce4d8d7cc7cc6de438c5488adc5297e5b7ffef88816c0a91bd289c1"
|
||||
"checksum sig 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c6649e43c1a1e68d29ed56d0dc3b5b6cf3b901da77cf107c4066b9e3da036df5"
|
||||
"checksum signpost 0.1.0 (git+https://github.com/pcwalton/signpost.git)" = "<none>"
|
||||
"checksum simd 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a94d14a2ae1f1f110937de5fb69e494372560181c7e1739a097fcc2cee37ba0"
|
||||
"checksum siphasher 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0df90a788073e8d0235a67e50441d47db7c8ad9debd91cbf43736a2a92d36537"
|
||||
"checksum slab 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "17b4fcaed89ab08ef143da37bc52adbcc04d4a69014f4c1208d6b51f0c47bc23"
|
||||
"checksum smallbitvec 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "665fbc8384f961eb55c548daa2a4b1efff1f9d03b7a10f162ac6ad6a781ca966"
|
||||
|
|
|
@ -13,7 +13,7 @@ test = false
|
|||
doctest = false
|
||||
|
||||
[features]
|
||||
unstable = ["simd"]
|
||||
unstable = []
|
||||
|
||||
[dependencies]
|
||||
app_units = "0.6"
|
||||
|
@ -60,9 +60,6 @@ servo-fontconfig = "0.2.1"
|
|||
[target.'cfg(target_os = "android")'.dependencies]
|
||||
xml5ever = {version = "0.12"}
|
||||
|
||||
[target.'cfg(any(target_feature = "sse2", target_feature = "neon"))'.dependencies]
|
||||
simd = {version = "0.2.0", optional = true}
|
||||
|
||||
[target.'cfg(target_os = "windows")'.dependencies]
|
||||
dwrote = "0.4"
|
||||
truetype = "0.26"
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// For SIMD
|
||||
#![cfg_attr(feature = "unstable", feature(cfg_target_feature))]
|
||||
#![cfg_attr(feature = "unstable", feature(cfg_target_feature, stdsimd))]
|
||||
|
||||
#![deny(unsafe_code)]
|
||||
|
||||
|
@ -50,9 +50,6 @@ extern crate range;
|
|||
extern crate servo_arc;
|
||||
#[macro_use] extern crate servo_atoms;
|
||||
extern crate servo_url;
|
||||
#[cfg(feature = "unstable")]
|
||||
#[cfg(any(target_feature = "sse2", target_feature = "neon"))]
|
||||
extern crate simd;
|
||||
extern crate smallvec;
|
||||
extern crate style;
|
||||
extern crate time;
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
use app_units::Au;
|
||||
use euclid::Point2D;
|
||||
use range::{self, EachIndex, Range, RangeIndex};
|
||||
#[cfg(all(feature = "unstable", any(target_feature = "sse2", target_feature = "neon")))]
|
||||
use simd::u32x4;
|
||||
use std::{fmt, mem, u16};
|
||||
use std::cmp::{Ordering, PartialOrd};
|
||||
#[cfg(all(feature = "unstable", any(target_feature = "sse2", target_feature = "neon")))]
|
||||
use std::simd::u32x4;
|
||||
use std::vec::Vec;
|
||||
|
||||
pub use gfx_traits::ByteIndex;
|
||||
|
@ -606,7 +606,8 @@ impl<'a> GlyphStore {
|
|||
let buf = self.transmute_entry_buffer_to_u32_buffer();
|
||||
|
||||
for i in 0..num_simd_iterations {
|
||||
let v = u32x4::load(buf, begin + i * 4);
|
||||
let offset = begin + i * 4;
|
||||
let v = u32x4::load_unaligned(&buf[offset..]);
|
||||
let advance = (v & advance_mask) >> GLYPH_ADVANCE_SHIFT;
|
||||
let spaces = (v & space_flag_mask) >> FLAG_CHAR_IS_SPACE_SHIFT;
|
||||
simd_advance = simd_advance + advance;
|
||||
|
@ -647,7 +648,10 @@ impl<'a> GlyphStore {
|
|||
#[cfg(any(target_feature = "sse2", target_feature = "neon"))]
|
||||
#[allow(unsafe_code)]
|
||||
fn transmute_entry_buffer_to_u32_buffer(&self) -> &[u32] {
|
||||
unsafe { mem::transmute(self.entry_buffer.as_slice()) }
|
||||
// Statically assert identical sizes
|
||||
let _ = mem::transmute::<GlyphEntry, u32>;
|
||||
|
||||
unsafe { mem::transmute::<&[GlyphEntry], &[u32]>(self.entry_buffer.as_slice()) }
|
||||
}
|
||||
|
||||
pub fn char_is_space(&self, i: ByteIndex) -> bool {
|
||||
|
|
|
@ -62,7 +62,6 @@ licenses_dep_toml = [
|
|||
'name = "freetype"',
|
||||
'name = "js"',
|
||||
'name = "servo-freetype-sys"',
|
||||
'name = "simd"',
|
||||
'name = "webrender"',
|
||||
'name = "webrender_api"',
|
||||
]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue