Stratax 0.2.0
Loading...
Searching...
No Matches
Bitwise.hpp File Reference

Go to the source code of this file.

Functions

template<Array A>
requires Integer<typename A::value_type>
void require_same_bitwise_shape (const A &lhs, const A &rhs)
 Verifies that two arrays have the same shape before bitwise operations.
template<Array A>
requires Integer<typename A::value_type>
operator~ (const A &value)
 Applies bitwise NOT to each element of an integer array.
template<Array A>
requires Integer<typename A::value_type>
operator& (const A &lhs, const A &rhs)
 Applies element-wise bitwise AND between two arrays.
template<Array A>
requires Integer<typename A::value_type>
operator| (const A &lhs, const A &rhs)
 Applies element-wise bitwise OR between two arrays.
template<Array A>
requires Integer<typename A::value_type>
operator^ (const A &lhs, const A &rhs)
 Applies element-wise bitwise XOR between two arrays.
template<Array A>
requires Integer<typename A::value_type>
operator<< (const A &lhs, const A &rhs)
 Applies element-wise left shift using per-element shift counts.
template<Array A>
requires Integer<typename A::value_type>
operator>> (const A &lhs, const A &rhs)
 Applies element-wise right shift using per-element shift counts.
template<Array A, Integer Scalar>
requires Integer<typename A::value_type>
operator& (const A &lhs, const Scalar &rhs)
 Applies bitwise AND between each array element and a scalar.
template<Array A, Integer Scalar>
requires Integer<typename A::value_type>
operator| (const A &lhs, const Scalar &rhs)
 Applies bitwise OR between each array element and a scalar.
template<Array A, Integer Scalar>
requires Integer<typename A::value_type>
operator^ (const A &lhs, const Scalar &rhs)
 Applies bitwise XOR between each array element and a scalar.
template<Array A, Integer Scalar>
requires Integer<typename A::value_type>
operator<< (const A &lhs, const Scalar &rhs)
 Left-shifts each array element by a scalar shift count.
template<Array A, Integer Scalar>
requires Integer<typename A::value_type>
operator>> (const A &lhs, const Scalar &rhs)
 Right-shifts each array element by a scalar shift count.
template<Integer Scalar, Array A>
requires Integer<typename A::value_type>
operator& (const Scalar &lhs, const A &rhs)
 Applies bitwise AND between a scalar and each array element.
template<Integer Scalar, Array A>
requires Integer<typename A::value_type>
operator| (const Scalar &lhs, const A &rhs)
 Applies bitwise OR between a scalar and each array element.
template<Integer Scalar, Array A>
requires Integer<typename A::value_type>
operator^ (const Scalar &lhs, const A &rhs)
 Applies bitwise XOR between a scalar and each array element.
template<Integer Scalar, Array A>
requires Integer<typename A::value_type>
operator<< (const Scalar &lhs, const A &rhs)
 Left-shifts a scalar value by each array element as shift count.
template<Integer Scalar, Array A>
requires Integer<typename A::value_type>
operator>> (const Scalar &lhs, const A &rhs)
 Right-shifts a scalar value by each array element as shift count.
template<Array A>
requires Integer<typename A::value_type>
A & operator&= (A &lhs, const A &rhs)
 Applies element-wise bitwise AND assignment.
template<Array A>
requires Integer<typename A::value_type>
A & operator|= (A &lhs, const A &rhs)
 Applies element-wise bitwise OR assignment.
template<Array A>
requires Integer<typename A::value_type>
A & operator^= (A &lhs, const A &rhs)
 Applies element-wise bitwise XOR assignment.
template<Array A>
requires Integer<typename A::value_type>
A & operator<<= (A &lhs, const A &rhs)
 Applies element-wise left-shift assignment.
template<Array A>
requires Integer<typename A::value_type>
A & operator>>= (A &lhs, const A &rhs)
 Applies element-wise right-shift assignment.
template<Array A, Integer Scalar>
requires Integer<typename A::value_type>
A & operator&= (A &lhs, const Scalar &rhs)
 Applies bitwise AND assignment with a scalar.
template<Array A, Integer Scalar>
requires Integer<typename A::value_type>
A & operator|= (A &lhs, const Scalar &rhs)
 Applies bitwise OR assignment with a scalar.
template<Array A, Integer Scalar>
requires Integer<typename A::value_type>
A & operator^= (A &lhs, const Scalar &rhs)
 Applies bitwise XOR assignment with a scalar.
template<Array A, Integer Scalar>
requires Integer<typename A::value_type>
A & operator<<= (A &lhs, const Scalar &rhs)
 Applies left-shift assignment with a scalar shift count.
template<Array A, Integer Scalar>
requires Integer<typename A::value_type>
A & operator>>= (A &lhs, const Scalar &rhs)
 Applies right-shift assignment with a scalar shift count.

Function Documentation

◆ operator&() [1/3]

template<Array A>
requires Integer<typename A::value_type>
A operator& ( const A & lhs,
const A & rhs )

Applies element-wise bitwise AND between two arrays.

Parameters
lhsLeft-hand operand.
rhsRight-hand operand.
Returns
Array with element-wise bitwise AND results.

Definition at line 56 of file Bitwise.hpp.

◆ operator&() [2/3]

template<Array A, Integer Scalar>
requires Integer<typename A::value_type>
A operator& ( const A & lhs,
const Scalar & rhs )

Applies bitwise AND between each array element and a scalar.

Parameters
lhsArray operand.
rhsScalar operand.
Returns
Array with element-wise bitwise AND results.

Definition at line 193 of file Bitwise.hpp.

◆ operator&() [3/3]

template<Integer Scalar, Array A>
requires Integer<typename A::value_type>
A operator& ( const Scalar & lhs,
const A & rhs )

Applies bitwise AND between a scalar and each array element.

Parameters
lhsScalar operand.
rhsArray operand.
Returns
Array with element-wise bitwise AND results.

Definition at line 305 of file Bitwise.hpp.

◆ operator&=() [1/2]

template<Array A>
requires Integer<typename A::value_type>
A & operator&= ( A & lhs,
const A & rhs )

Applies element-wise bitwise AND assignment.

Parameters
lhsLeft-hand operand to modify.
rhsRight-hand operand.
Returns
Reference to the modified left-hand operand.

Definition at line 393 of file Bitwise.hpp.

◆ operator&=() [2/2]

template<Array A, Integer Scalar>
requires Integer<typename A::value_type>
A & operator&= ( A & lhs,
const Scalar & rhs )

Applies bitwise AND assignment with a scalar.

Parameters
lhsArray operand to modify.
rhsScalar operand.
Returns
Reference to the modified array.

Definition at line 470 of file Bitwise.hpp.

◆ operator<<() [1/3]

template<Array A>
requires Integer<typename A::value_type>
A operator<< ( const A & lhs,
const A & rhs )

Applies element-wise left shift using per-element shift counts.

Parameters
lhsValue operand array.
rhsShift-count operand array.
Returns
Array with element-wise left-shift results.

Definition at line 137 of file Bitwise.hpp.

◆ operator<<() [2/3]

template<Array A, Integer Scalar>
requires Integer<typename A::value_type>
A operator<< ( const A & lhs,
const Scalar & rhs )

Left-shifts each array element by a scalar shift count.

Parameters
lhsArray operand.
rhsScalar shift count.
Returns
Array with element-wise left-shift results.

Definition at line 259 of file Bitwise.hpp.

◆ operator<<() [3/3]

template<Integer Scalar, Array A>
requires Integer<typename A::value_type>
A operator<< ( const Scalar & lhs,
const A & rhs )

Left-shifts a scalar value by each array element as shift count.

Parameters
lhsScalar value operand.
rhsArray shift-count operand.
Returns
Array with element-wise left-shift results.

Definition at line 347 of file Bitwise.hpp.

◆ operator<<=() [1/2]

template<Array A>
requires Integer<typename A::value_type>
A & operator<<= ( A & lhs,
const A & rhs )

Applies element-wise left-shift assignment.

Parameters
lhsLeft-hand value operand to modify.
rhsRight-hand shift-count operand.
Returns
Reference to the modified left-hand operand.

Definition at line 438 of file Bitwise.hpp.

◆ operator<<=() [2/2]

template<Array A, Integer Scalar>
requires Integer<typename A::value_type>
A & operator<<= ( A & lhs,
const Scalar & rhs )

Applies left-shift assignment with a scalar shift count.

Parameters
lhsArray value operand to modify.
rhsScalar shift count.
Returns
Reference to the modified array.

Definition at line 515 of file Bitwise.hpp.

◆ operator>>() [1/3]

template<Array A>
requires Integer<typename A::value_type>
A operator>> ( const A & lhs,
const A & rhs )

Applies element-wise right shift using per-element shift counts.

Parameters
lhsValue operand array.
rhsShift-count operand array.
Returns
Array with element-wise right-shift results.

Definition at line 164 of file Bitwise.hpp.

◆ operator>>() [2/3]

template<Array A, Integer Scalar>
requires Integer<typename A::value_type>
A operator>> ( const A & lhs,
const Scalar & rhs )

Right-shifts each array element by a scalar shift count.

Parameters
lhsArray operand.
rhsScalar shift count.
Returns
Array with element-wise right-shift results.

Definition at line 281 of file Bitwise.hpp.

◆ operator>>() [3/3]

template<Integer Scalar, Array A>
requires Integer<typename A::value_type>
A operator>> ( const Scalar & lhs,
const A & rhs )

Right-shifts a scalar value by each array element as shift count.

Parameters
lhsScalar value operand.
rhsArray shift-count operand.
Returns
Array with element-wise right-shift results.

Definition at line 369 of file Bitwise.hpp.

◆ operator>>=() [1/2]

template<Array A>
requires Integer<typename A::value_type>
A & operator>>= ( A & lhs,
const A & rhs )

Applies element-wise right-shift assignment.

Parameters
lhsLeft-hand value operand to modify.
rhsRight-hand shift-count operand.
Returns
Reference to the modified left-hand operand.

Definition at line 453 of file Bitwise.hpp.

◆ operator>>=() [2/2]

template<Array A, Integer Scalar>
requires Integer<typename A::value_type>
A & operator>>= ( A & lhs,
const Scalar & rhs )

Applies right-shift assignment with a scalar shift count.

Parameters
lhsArray value operand to modify.
rhsScalar shift count.
Returns
Reference to the modified array.

Definition at line 530 of file Bitwise.hpp.

◆ operator^() [1/3]

template<Array A>
requires Integer<typename A::value_type>
A operator^ ( const A & lhs,
const A & rhs )

Applies element-wise bitwise XOR between two arrays.

Parameters
lhsLeft-hand operand.
rhsRight-hand operand.
Returns
Array with element-wise bitwise XOR results.

Definition at line 110 of file Bitwise.hpp.

◆ operator^() [2/3]

template<Array A, Integer Scalar>
requires Integer<typename A::value_type>
A operator^ ( const A & lhs,
const Scalar & rhs )

Applies bitwise XOR between each array element and a scalar.

Parameters
lhsArray operand.
rhsScalar operand.
Returns
Array with element-wise bitwise XOR results.

Definition at line 237 of file Bitwise.hpp.

◆ operator^() [3/3]

template<Integer Scalar, Array A>
requires Integer<typename A::value_type>
A operator^ ( const Scalar & lhs,
const A & rhs )

Applies bitwise XOR between a scalar and each array element.

Parameters
lhsScalar operand.
rhsArray operand.
Returns
Array with element-wise bitwise XOR results.

Definition at line 333 of file Bitwise.hpp.

◆ operator^=() [1/2]

template<Array A>
requires Integer<typename A::value_type>
A & operator^= ( A & lhs,
const A & rhs )

Applies element-wise bitwise XOR assignment.

Parameters
lhsLeft-hand operand to modify.
rhsRight-hand operand.
Returns
Reference to the modified left-hand operand.

Definition at line 423 of file Bitwise.hpp.

◆ operator^=() [2/2]

template<Array A, Integer Scalar>
requires Integer<typename A::value_type>
A & operator^= ( A & lhs,
const Scalar & rhs )

Applies bitwise XOR assignment with a scalar.

Parameters
lhsArray operand to modify.
rhsScalar operand.
Returns
Reference to the modified array.

Definition at line 500 of file Bitwise.hpp.

◆ operator|() [1/3]

template<Array A>
requires Integer<typename A::value_type>
A operator| ( const A & lhs,
const A & rhs )

Applies element-wise bitwise OR between two arrays.

Parameters
lhsLeft-hand operand.
rhsRight-hand operand.
Returns
Array with element-wise bitwise OR results.

Definition at line 83 of file Bitwise.hpp.

◆ operator|() [2/3]

template<Array A, Integer Scalar>
requires Integer<typename A::value_type>
A operator| ( const A & lhs,
const Scalar & rhs )

Applies bitwise OR between each array element and a scalar.

Parameters
lhsArray operand.
rhsScalar operand.
Returns
Array with element-wise bitwise OR results.

Definition at line 215 of file Bitwise.hpp.

◆ operator|() [3/3]

template<Integer Scalar, Array A>
requires Integer<typename A::value_type>
A operator| ( const Scalar & lhs,
const A & rhs )

Applies bitwise OR between a scalar and each array element.

Parameters
lhsScalar operand.
rhsArray operand.
Returns
Array with element-wise bitwise OR results.

Definition at line 319 of file Bitwise.hpp.

◆ operator|=() [1/2]

template<Array A>
requires Integer<typename A::value_type>
A & operator|= ( A & lhs,
const A & rhs )

Applies element-wise bitwise OR assignment.

Parameters
lhsLeft-hand operand to modify.
rhsRight-hand operand.
Returns
Reference to the modified left-hand operand.

Definition at line 408 of file Bitwise.hpp.

◆ operator|=() [2/2]

template<Array A, Integer Scalar>
requires Integer<typename A::value_type>
A & operator|= ( A & lhs,
const Scalar & rhs )

Applies bitwise OR assignment with a scalar.

Parameters
lhsArray operand to modify.
rhsScalar operand.
Returns
Reference to the modified array.

Definition at line 485 of file Bitwise.hpp.

◆ operator~()

template<Array A>
requires Integer<typename A::value_type>
A operator~ ( const A & value)

Applies bitwise NOT to each element of an integer array.

Parameters
valueInput array.
Returns
Array with element-wise bitwise NOT results.

Definition at line 32 of file Bitwise.hpp.

◆ require_same_bitwise_shape()

template<Array A>
requires Integer<typename A::value_type>
void require_same_bitwise_shape ( const A & lhs,
const A & rhs )

Verifies that two arrays have the same shape before bitwise operations.

Parameters
lhsLeft-hand operand.
rhsRight-hand operand.

Definition at line 14 of file Bitwise.hpp.