aboutsummaryrefslogtreecommitdiffstats
path: root/common/nextpnr.h
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2018-06-19 16:23:23 +0200
committerClifford Wolf <clifford@clifford.at>2018-06-19 16:23:23 +0200
commit5af5bd23d0fd7f16e08ca0d396e7985205c56ffb (patch)
treec7eeafb33b37aff5a4c0a96cacf334e5f390cbc2 /common/nextpnr.h
parent8e26e4381be1e95479965756feba0237bd6e0582 (diff)
downloadnextpnr-5af5bd23d0fd7f16e08ca0d396e7985205c56ffb.tar.gz
nextpnr-5af5bd23d0fd7f16e08ca0d396e7985205c56ffb.tar.bz2
nextpnr-5af5bd23d0fd7f16e08ca0d396e7985205c56ffb.zip
Add Context::sorted_shuffle API
Signed-off-by: Clifford Wolf <clifford@clifford.at>
Diffstat (limited to 'common/nextpnr.h')
-rw-r--r--common/nextpnr.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/common/nextpnr.h b/common/nextpnr.h
index 2d614058..6e4b87bd 100644
--- a/common/nextpnr.h
+++ b/common/nextpnr.h
@@ -23,6 +23,7 @@
#include <unordered_map>
#include <unordered_set>
#include <vector>
+#include <algorithm>
#ifndef NEXTPNR_H
#define NEXTPNR_H
@@ -328,6 +329,12 @@ struct Context : Arch
std::swap(a[i], a[j]);
}
}
+
+ template <typename T> void sorted_shuffle(std::vector<T> &a)
+ {
+ std::sort(a.begin(), a.end());
+ shuffle(a);
+ }
};
NEXTPNR_NAMESPACE_END