#[repr(transparent)]
pub struct I64x2(_);
Expand description

[i64; 2] as a vector.

Implementations

Create a vector from an array.

Unlike the From trait function, the from_array function is const.

Example
const MY_EXTREMELY_FUN_VALUE: I64x2 =
    I64x2::from_array([0, 1]);
for (i, value) in MY_EXTREMELY_FUN_VALUE.as_array().iter().copied().enumerate() {
    assert_eq!(i as i64, value);
}
Avx2

Trait Implementations

Scalar Equivalent:
I64x2::from([
    self.as_array()[0].wrapping_add(rhs.as_array()[0]),
    self.as_array()[1].wrapping_add(rhs.as_array()[1]),
])
Avx2
The resulting type after applying the + operator.
Performs the += operation. Read more
Scalar Equivalent:
I64x2::from([
    self.as_array()[0] & rhs.as_array()[0],
    self.as_array()[1] & rhs.as_array()[1],
])
Avx2
The resulting type after applying the & operator.
Performs the &= operation. Read more
Scalar Equivalent:
I64x2::from([
    self.as_array()[0] | rhs.as_array()[0],
    self.as_array()[1] | rhs.as_array()[1],
])
Avx2
The resulting type after applying the | operator.
Performs the |= operation. Read more
Scalar Equivalent:
I64x2::from([
    self.as_array()[0] ^ rhs.as_array()[0],
    self.as_array()[1] ^ rhs.as_array()[1],
])
Avx2
The resulting type after applying the ^ operator.
Performs the ^= operation. Read more
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Select a or b according to choice. Read more
Conditionally assign other to self, according to choice. Read more
Conditionally swap self and other if choice == 1; otherwise, reassign both unto themselves. Read more
Determine if two items are equal. Read more
Formats the value using the given formatter. Read more

The zero vector.

Scalar Equivalent:
I64x2::from([
        i64::from(vector.as_array()[0]),
        i64::from(vector.as_array()[1]),
])
Avx2
Scalar Equivalent:
I64x2::from([
        i64::from(vector.as_array()[0]),
        i64::from(vector.as_array()[1]),
])
Avx2
Scalar Equivalent:
I64x2::from([
        i64::from(vector.as_array()[0]),
        i64::from(vector.as_array()[1]),
])
Avx2
Avx2

This cast is 100% free. It reinterprets the little-endinan bits of I16x8 as little endian bits of I64x2.

This cast is 100% free. It reinterprets the little-endinan bits of I32x4 as little endian bits of I64x2.

Avx2

This cast is 100% free. It reinterprets the little-endinan bits of I64x2 as little endian bits of I16x8.

This cast is 100% free. It reinterprets the little-endinan bits of I64x2 as little endian bits of I32x4.

NOTE: this will zero the upper bits of the destination. Other intrinsics are more effcient, but leave the upper bits undefined. At present, these more effcient intrinsics are not exposed.

Scalar Equivalent:
let mut out = [0; 4];
out[0..2].copy_from_slice(&vector.as_array());
I64x4::from(out)
Avx2

This cast is 100% free. It reinterprets the little-endinan bits of I64x2 as little endian bits of I8x16.

This cast is 100% free. It reinterprets the little-endinan bits of I64x2 as little endian bits of U16x8.

This cast is 100% free. It reinterprets the little-endinan bits of I64x2 as little endian bits of U32x4.

This cast is 100% free. It reinterprets the little-endinan bits of I64x2 as little endian bits of U64x2.

This cast is 100% free. It reinterprets the little-endinan bits of I64x2 as little endian bits of U8x16.

This cast is 100% free. It reinterprets the little-endinan bits of I8x16 as little endian bits of I64x2.

This cast is 100% free. It reinterprets the little-endinan bits of U16x8 as little endian bits of I64x2.

This cast is 100% free. It reinterprets the little-endinan bits of U32x4 as little endian bits of I64x2.

This cast is 100% free. It reinterprets the little-endinan bits of U64x2 as little endian bits of I64x2.

This cast is 100% free. It reinterprets the little-endinan bits of U8x16 as little endian bits of I64x2.

Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
Scalar Equivalent:
let mut out = self.as_array();
for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) {
    *x = if amm >= 64 || amm < 0 {
        0
    } else {
        *x << amm
    };
}
I64x2::from(out)
Avx2

WARNING: this implementation is a polyfill which executes the scalar implemenation.

The resulting type after applying the << operator.
Scalar Equivalent:
if amount >= 64 {
    I64x2::ZERO
} else {
    I64x2::from([
        self.as_array()[0] << amount,
        self.as_array()[1] << amount,
    ])
}
Avx2

WARNING: this implementation is a polyfill which executes the scalar implemenation.

The resulting type after applying the << operator.
Performs the <<= operation. Read more
Performs the <<= operation. Read more
Scalar Equivalent:
let mut out = self.as_array();
for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) {
    *x = if amm >= 64 || amm < 0 {
        if *x < 0 { -1 } else { 0 }
    } else {
        *x >> amm
    };
}
I64x2::from(out)
Avx2

WARNING: this implementation is a polyfill which executes the scalar implemenation.

The resulting type after applying the >> operator.
Scalar Equivalent:
if amount >= 64 {
    let mut out = self.as_array();
    for x in out.iter_mut() {
        *x = if *x < 0 { -1 } else { 0 };
    }
    I64x2::from(out)
} else {
    I64x2::from([
        self.as_array()[0] >> amount,
        self.as_array()[1] >> amount,
    ])
}
Avx2

WARNING: this implementation is a polyfill which executes the scalar implemenation.

The resulting type after applying the >> operator.
Performs the >>= operation. Read more
Performs the >>= operation. Read more
Scalar Equivalent:
self.as_array().iter().all(|x| *x == 0)
Avx2
Scalar Equivalent:
let mut out = [0; 2];
out[0] = scalar;
I64x2::from(out)
Avx2
Scalar Equivalent:
self.as_array()[I]
Avx2
Scalar Equivalent:
I64x2::from([scalar; 2])
Avx2
Scalar Equivalent:
I64x2::from([vector.as_array()[0]; 2])
Avx2
Scalar Equivalent:
I64x2::from([
    if self.as_array()[0] == other.as_array()[0] {  -1  } else { 0 },
    if self.as_array()[1] == other.as_array()[1] {  -1  } else { 0 },
])
Avx2
Scalar Equivalent:
I64x2::from([
    self.as_array()[0] & (!other.as_array()[0]),
    self.as_array()[1] & (!other.as_array()[1]),
])
Avx2
Scalar Equivalent:
I64x2::from([
    if self.as_array()[0] > other.as_array()[0] {  -1  } else { 0 },
    if self.as_array()[1] > other.as_array()[1] {  -1  } else { 0 },
])
Avx2
Scalar Equivalent:
let mut out = self.as_array();
for x in out.iter_mut() {
    *x <<= BITS;
}
I64x2::from(out)
Avx2
Scalar Equivalent:
let mut out = self.as_array();
for x in out.iter_mut() {
    *x >>= BITS;
}
I64x2::from(out)
Avx2

WARNING: this implementation is a polyfill which executes the scalar implemenation.

Scalar Equivalent:
I64x2::from([
    // Lane# 0
    self.as_array()[0],
    other.as_array()[0],
])
Avx2
Scalar Equivalent:
I64x2::from([
    // Lane# 0
    self.as_array()[1],
    other.as_array()[1],
])
Avx2
Scalar Equivalent:
I64x2::from([
    self.as_array()[0].max(other.as_array()[0]),
    self.as_array()[1].max(other.as_array()[1]),
])
Avx2

WARNING: this implementation is a polyfill which executes the scalar implemenation.

Scalar Equivalent:
I64x2::from([
    self.as_array()[0].min(other.as_array()[0]),
    self.as_array()[1].min(other.as_array()[1]),
])
Avx2

WARNING: this implementation is a polyfill which executes the scalar implemenation.

The scalar that this value holds.
The equivalent array type of this vector.
The signed version of this vector.
The unsigned version of this vector.
The number of elements of this vector. Read more
Convert the vector to an array.
Scalar Equivalent:
I64x2::from([
    ((self.as_array()[0] as i32) as i64) * ((other.as_array()[0] as i32) as i64),
    ((self.as_array()[1] as i32) as i64) * ((other.as_array()[1] as i32) as i64),
])
Avx2

Safety

base does not need to be aligned. Forall i, base + indices[i] must meet the safety requirements of std::ptr::read_unaligned

Scalar Equivalent:
I64x2::from([
    base.offset(indices.as_array()[0] as isize).read_unaligned(),
    base.offset(indices.as_array()[1] as isize).read_unaligned(),
])
Avx2
Scalar Equivalent:
I64x2::from([
    if ((mask.as_array()[0] as u64) >> 63) == 1 {
        base.offset(indices.as_array()[0] as isize).read_unaligned()
    } else {
        src.as_array()[0]
    },
    if ((mask.as_array()[1] as u64) >> 63) == 1 {
        base.offset(indices.as_array()[1] as isize).read_unaligned()
    } else {
        src.as_array()[1]
    },
])
Avx2

Safety

base does not need to be aligned. Forall i, base + indices[i] must meet the safety requirements of std::ptr::read_unaligned

Scalar Equivalent:
U64x2::from([
    base.offset(indices.as_array()[0] as isize).read_unaligned(),
    base.offset(indices.as_array()[1] as isize).read_unaligned(),
])
Avx2
Scalar Equivalent:
U64x2::from([
    if (mask.as_array()[0] >> 63) == 1 {
        base.offset(indices.as_array()[0] as isize).read_unaligned()
    } else {
        src.as_array()[0]
    },
    if (mask.as_array()[1] >> 63) == 1 {
        base.offset(indices.as_array()[1] as isize).read_unaligned()
    } else {
        src.as_array()[1]
    },
])
Avx2

Safety

base does not need to be aligned. Forall i, base + indices[i] must meet the safety requirements of std::ptr::read_unaligned

Scalar Equivalent:
I64x2::from([
    base.offset(indices.as_array()[0] as isize).read_unaligned(),
    base.offset(indices.as_array()[1] as isize).read_unaligned(),
])
Avx2
Scalar Equivalent:
I64x2::from([
    if ((mask.as_array()[0] as u64) >> 63) == 1 {
        base.offset(indices.as_array()[0] as isize).read_unaligned()
    } else {
        src.as_array()[0]
    },
    if ((mask.as_array()[1] as u64) >> 63) == 1 {
        base.offset(indices.as_array()[1] as isize).read_unaligned()
    } else {
        src.as_array()[1]
    },
])
Avx2
Scalar Equivalent:
I64x2::from([
    self.as_array()[0].wrapping_sub(rhs.as_array()[0]),
    self.as_array()[1].wrapping_sub(rhs.as_array()[1]),
])
Avx2
The resulting type after applying the - operator.
Performs the -= operation. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Self must have the same layout as the specified Bits except for the possible invalid bit patterns being checked during is_valid_bit_pattern. Read more
If this function returns true, then it must be valid to reinterpret bits as &Self. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.