Use Bits library for bit instrisics.
Signed-off-by: Keith Rothman <537074+litghost@users.noreply.github.com>
This commit is contained in:
parent
558a753d3d
commit
8f668f06ca
@ -24,6 +24,8 @@
|
|||||||
#error Include after "nextpnr.h" only.
|
#error Include after "nextpnr.h" only.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "bits.h"
|
||||||
|
|
||||||
NEXTPNR_NAMESPACE_BEGIN
|
NEXTPNR_NAMESPACE_BEGIN
|
||||||
|
|
||||||
// Implementation for exclusive state groups, used to implement generic
|
// Implementation for exclusive state groups, used to implement generic
|
||||||
@ -103,10 +105,10 @@ template <size_t StateCount, typename StateType = int8_t, typename CountType = u
|
|||||||
|
|
||||||
// Check whether the state group is now unselected or satified.
|
// Check whether the state group is now unselected or satified.
|
||||||
auto value = selected_states.to_ulong();
|
auto value = selected_states.to_ulong();
|
||||||
auto number_selected = __builtin_popcount(value);
|
auto number_selected = nextpnr::Bits::popcount(value);
|
||||||
if (number_selected == 1) {
|
if (number_selected == 1) {
|
||||||
// Group is no longer overconstrained.
|
// Group is no longer overconstrained.
|
||||||
state = __builtin_ctz(value);
|
state = nextpnr::Bits::ctz(value);
|
||||||
NPNR_ASSERT(selected_states[state]);
|
NPNR_ASSERT(selected_states[state]);
|
||||||
} else if (number_selected == 0) {
|
} else if (number_selected == 0) {
|
||||||
// Group is unselected.
|
// Group is unselected.
|
||||||
|
Loading…
Reference in New Issue
Block a user