prefetch 0.2.0

prefetch provides a type-safe wrapper around LLVM's prefetch intrinsic
Documentation
1
2
3
4
5
6
b0VIM 7.4�
�Y�|Daviaweinstock-debian~avi/Documents/github_repos/prefetch/src/prefetch.rsutf-8
3210#"! Utp2adhL2����X-,���m!�
�
�
�
�
�
a
X
5
������a85�y/�
�
�
i
"
�	�	�	Z		���S�NL}}}    unsafe { llvm_prefetch(mem::transmute::<*c}    unsafe { llvm_prefetch(mem::transmute::<*const T, *mut i8>(x), RW::VALUE, Loc::VALUE, Cache::VALUE); }    // This should be exposable as safe, since "Prefetches have no effect on the behavior of the program but can change its performance characteristics."pub fn prefetch<RW: ReadWrite, Loc: Locality, Cache: CacheType, T>(x: *const T) {#[inline(always)]pub struct Data; unsafe impl CacheType for Data { const VALUE: i32 = 1; }pub struct Instruction; unsafe impl CacheType for Instruction { const VALUE: i32 = 0; }pub unsafe trait CacheType { const VALUE: i32; }pub struct High; unsafe impl Locality for High { const VALUE: i32 = 3; }pub struct Medium; unsafe impl Locality for Medium { const VALUE: i32 = 2; }pub struct Low; unsafe impl Locality for Low { const VALUE: i32 = 1; }pub struct None; unsafe impl Locality for None { const VALUE: i32 = 0; }pub unsafe trait Locality { const VALUE: i32; }pub struct Write; unsafe impl ReadWrite for Write { const VALUE: i32 = 1; }pub struct Read; unsafe impl ReadWrite for Read { const VALUE: i32 = 0; }pub unsafe trait ReadWrite { const VALUE: i32; }// These are promoted type-level versions of the above enums, since "The rw, locality and cache type arguments must be constant integers."*/pub enum CacheType { Instruction, Data }pub enum Locality { None, Low, Medium, High }pub enum ReadWrite { Read, Write }/*// http://llvm.org/docs/LangRef.html#llvm-prefetch-intrinsic}    fn llvm_prefetch(a: *mut i8, b: i32, c: i32, d: i32) -> ();    #[link_name = "llvm.prefetch"]extern {// adapted from llvmint generated bindings to remove the dependencyuse std::mem;*/   limitations under the License.   See the License for the specific language governing permissions and   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   distributed under the License is distributed on an "AS IS" BASIS,   Unless required by applicable law or agreed to in writing, software       http://www.apache.org/licenses/LICENSE-2.0   You may obtain a copy of the License at   you may not use this file except in compliance with the License.   Licensed under the Apache License, Version 2.0 (the "License");Copyright 2016 Avi Weinstock/*