A64: Implement DUP (general)

This commit is contained in:
MerryMage
2018-01-24 12:00:56 +00:00
parent 793753bf63
commit 3caf192f60
4 changed files with 54 additions and 1 deletions

View File

@@ -98,6 +98,17 @@ inline int HighestSetBit(T value) {
return result;
}
template <typename T>
inline size_t LowestSetBit(T value) {
auto x = static_cast<std::make_unsigned_t<T>>(value);
size_t result = 0;
while ((x & 1) == 0) {
x >>= 1;
result++;
}
return result;
}
template <typename T>
inline T Ones(size_t count) {
ASSERT_MSG(count <= BitSize<T>(), "count larger than bitsize of T");