Debian Codegraph @

debian/missing-sources/safe_arch/src/x86_x64/popcnt.rs

raw
1 #![cfg(target_feature = "popcnt")]
2
3 use super::*;
4
5 /// Count the number of bits set within an `i32`
6 ///
7 /// * **Intrinsic:** [`_popcnt32`]
8 /// * **Assembly:** `popcnt r32, r32`
9 #[must_use]
10 #[inline(always)]
11 #[cfg_attr(docsrs, doc(cfg(target_feature = "popcnt")))]
12 pub fn population_count_i32(a: i32) -> i32 {
13 unsafe { _popcnt32(a) }
14 }
15
16 /// Count the number of bits set within an `i64`
17 ///
18 /// * **Intrinsic:** [`_popcnt64`]
19 /// * **Assembly:** `popcnt r64, r64`
20 #[must_use]
21 #[inline(always)]
22 #[cfg(target_arch = "x86_64")]
23 #[cfg_attr(docsrs, doc(cfg(target_feature = "popcnt")))]
24 pub fn population_count_i64(a: i64) -> i32 {
25 unsafe { _popcnt64(a) }
26 }
27