0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-29 10:12:39 +01:00

ircd::simd: Simplify traits constexprs.

This commit is contained in:
Jason Volk 2020-07-09 18:00:27 -07:00
parent 60d2f04c14
commit b1a60451b7
2 changed files with 15 additions and 15 deletions

View file

@ -55,7 +55,7 @@ noexcept
else
ret += __lzcnt64(__builtin_bswap64(a[i++])) & mask;
}
while(i < lanes(a));
while(i < lanes<T>());
return ret;
}
@ -67,7 +67,7 @@ inline uint
ircd::simd::ctz(const T a)
noexcept
{
uint ret(0), i(lanes(a)), mask(-1U); do
uint ret(0), i(lanes<T>()), mask(-1U); do
{
if constexpr(sizeof_lane<T>() <= sizeof(u16))
ret += __lzcnt16(a[--i]) & mask;

View file

@ -14,10 +14,10 @@
namespace ircd::simd
{
template<class T>
constexpr size_t sizeof_lane(T = {});
constexpr size_t sizeof_lane();
template<class T>
constexpr size_t lanes(T = {});
constexpr size_t lanes();
// lane number convenience constants
extern const u8x64 u8x64_lane_id;
@ -41,7 +41,7 @@ namespace ircd::simd
/// type name).
template<class T>
constexpr size_t
ircd::simd::lanes(T)
ircd::simd::lanes()
{
constexpr size_t ret
{
@ -59,7 +59,7 @@ ircd::simd::lanes(T)
/// Get the size of each lane; i.e the size of one integral element.
template<class T>
constexpr size_t
ircd::simd::sizeof_lane(T)
ircd::simd::sizeof_lane()
{
constexpr size_t ret
{
@ -76,63 +76,63 @@ ircd::simd::sizeof_lane(T)
template<>
constexpr size_t
ircd::simd::sizeof_lane(u128x1)
ircd::simd::sizeof_lane<ircd::u128x1>()
{
return 16;
};
template<>
constexpr size_t
ircd::simd::sizeof_lane(f128x1)
ircd::simd::sizeof_lane<ircd::f128x1>()
{
return 16;
};
template<>
constexpr size_t
ircd::simd::sizeof_lane(d128x1)
ircd::simd::sizeof_lane<ircd::d128x1>()
{
return 16;
};
template<>
constexpr size_t
ircd::simd::sizeof_lane(u256x1)
ircd::simd::sizeof_lane<ircd::u256x1>()
{
return 32;
};
template<>
constexpr size_t
ircd::simd::sizeof_lane(f256x1)
ircd::simd::sizeof_lane<ircd::f256x1>()
{
return 32;
};
template<>
constexpr size_t
ircd::simd::sizeof_lane(d256x1)
ircd::simd::sizeof_lane<ircd::d256x1>()
{
return 32;
};
template<>
constexpr size_t
ircd::simd::sizeof_lane(u512x1)
ircd::simd::sizeof_lane<ircd::u512x1>()
{
return 64;
};
template<>
constexpr size_t
ircd::simd::sizeof_lane(f512x1)
ircd::simd::sizeof_lane<ircd::f512x1>()
{
return 64;
};
template<>
constexpr size_t
ircd::simd::sizeof_lane(d512x1)
ircd::simd::sizeof_lane<ircd::d512x1>()
{
return 64;
};