Files
2025-10-25 03:02:53 +03:00

8.9 KiB
Raw Permalink Blame History

[simd.bit]

29 Numerics library [numerics]

29.10 Data-parallel types [simd]

29.10.8 basic_vec non-member operations [simd.nonmembers]

29.10.8.14 basic_vec bit library [simd.bit]

🔗

template<[simd-vec-type](simd.expos#concept:simd-vec-type "29.10.2Exposition-only types, variables, and concepts[simd.expos]") V> constexpr V byteswap(const V& v) noexcept;

1

#

Constraints: The type V::value_type models integral.

2

#

Returns: A basic_vec object where the ith element is initialized to the result of std::byteswap(v[i]) for all i in the range [0, V::size()).

🔗

template<[simd-vec-type](simd.expos#concept:simd-vec-type "29.10.2Exposition-only types, variables, and concepts[simd.expos]") V> constexpr V bit_ceil(const V& v) noexcept;

3

#

Constraints: The type V::value_type is an unsigned integer type ([basic.fundamental]).

4

#

Preconditions: For every i in the range [0, V::size()), the smallest power of 2 greater than or equal to v[i] is representable as a value of typeV::value_type.

5

#

Returns: A basic_vec object where the ith element is initialized to the result of std::bit_ceil(v[i]) for all i in the range [0, V::size()).

6

#

Remarks: A function call expression that violates the precondition in the Preconditions: element is not a core constant expression ([expr.const]).

🔗

template<[simd-vec-type](simd.expos#concept:simd-vec-type "29.10.2Exposition-only types, variables, and concepts[simd.expos]") V> constexpr V bit_floor(const V& v) noexcept;

7

#

Constraints: The type V::value_type is an unsigned integer type ([basic.fundamental]).

8

#

Returns: A basic_vec object where the ith element is initialized to the result of std::bit_floor(v[i]) for all i in the range [0, V::size()).

🔗

template<[simd-vec-type](simd.expos#concept:simd-vec-type "29.10.2Exposition-only types, variables, and concepts[simd.expos]") V> constexpr typename V::mask_type has_single_bit(const V& v) noexcept;

9

#

Constraints: The type V::value_type is an unsigned integer type ([basic.fundamental]).

10

#

Returns: A basic_mask object where the ith element is initialized to the result of std::has_single_bit(v[i]) for all i in the range [0, V::size()).

🔗

template<[simd-vec-type](simd.expos#concept:simd-vec-type "29.10.2Exposition-only types, variables, and concepts[simd.expos]") V0, [simd-vec-type](simd.expos#concept:simd-vec-type "29.10.2Exposition-only types, variables, and concepts[simd.expos]") V1> constexpr V0 rotl(const V0& v0, const V1& v1) noexcept; template<[simd-vec-type](simd.expos#concept:simd-vec-type "29.10.2Exposition-only types, variables, and concepts[simd.expos]") V0, [simd-vec-type](simd.expos#concept:simd-vec-type "29.10.2Exposition-only types, variables, and concepts[simd.expos]") V1> constexpr V0 rotr(const V0& v0, const V1& v1) noexcept;

11

#

Constraints:

The type V0::value_type is an unsigned integer type ([basic.fundamental]),

the type V1::value_type models integral,

V0::size() == V1::size() is true, and

sizeof(typename V0::value_type) == sizeof(typename V1::value_type) is true.

12

#

Returns: A basic_vec object where the ith element is initialized to the result of bit-func(v0[i],static_cast(v1[i])) for all i in the range [0, V0::size()), where bit-func is the corresponding scalar function from .

🔗

template<[simd-vec-type](simd.expos#concept:simd-vec-type "29.10.2Exposition-only types, variables, and concepts[simd.expos]") V> constexpr V rotl(const V& v, int s) noexcept; template<[simd-vec-type](simd.expos#concept:simd-vec-type "29.10.2Exposition-only types, variables, and concepts[simd.expos]") V> constexpr V rotr(const V& v, int s) noexcept;

13

#

Constraints: The type V::value_type is an unsigned integer type ([basic.fundamental]).

14

#

Returns: A basic_vec object where the ith element is initialized to the result of bit-func(v[i], s) for all i in the range [0, V::size()), where bit-func is the corresponding scalar function from .

🔗

template<[simd-vec-type](simd.expos#concept:simd-vec-type "29.10.2Exposition-only types, variables, and concepts[simd.expos]") V> constexpr rebind_t<make_signed_t<typename V::value_type>, V> bit_width(const V& v) noexcept; template<[simd-vec-type](simd.expos#concept:simd-vec-type "29.10.2Exposition-only types, variables, and concepts[simd.expos]") V> constexpr rebind_t<make_signed_t<typename V::value_type>, V> countl_zero(const V& v) noexcept; template<[simd-vec-type](simd.expos#concept:simd-vec-type "29.10.2Exposition-only types, variables, and concepts[simd.expos]") V> constexpr rebind_t<make_signed_t<typename V::value_type>, V> countl_one(const V& v) noexcept; template<[simd-vec-type](simd.expos#concept:simd-vec-type "29.10.2Exposition-only types, variables, and concepts[simd.expos]") V> constexpr rebind_t<make_signed_t<typename V::value_type>, V> countr_zero(const V& v) noexcept; template<[simd-vec-type](simd.expos#concept:simd-vec-type "29.10.2Exposition-only types, variables, and concepts[simd.expos]") V> constexpr rebind_t<make_signed_t<typename V::value_type>, V> countr_one(const V& v) noexcept; template<[simd-vec-type](simd.expos#concept:simd-vec-type "29.10.2Exposition-only types, variables, and concepts[simd.expos]") V> constexpr rebind_t<make_signed_t<typename V::value_type>, V> popcount(const V& v) noexcept;

15

#

Constraints: The type V::value_type is an unsigned integer type ([basic.fundamental]).

16

#

Returns: A basic_vec object where the ith element is initialized to the result of bit-func(v[i]) for all i in the range [0, V::size()), where bit-func is the corresponding scalar function from .