mirror of
https://github.com/aicodix/code.git
synced 2026-04-27 14:30:36 +00:00
use horizontal rotation helper
This commit is contained in:
parent
8de487af88
commit
969c43f016
2 changed files with 4 additions and 26 deletions
|
|
@ -11,6 +11,7 @@ Copyright 2018 Ahmet Inan <inan@aicodix.de>
|
|||
|
||||
#include <algorithm>
|
||||
#include "simd.hh"
|
||||
#include "rotate.hh"
|
||||
|
||||
namespace CODE {
|
||||
|
||||
|
|
@ -41,6 +42,7 @@ class LDPCDecoder
|
|||
static const int BNL = (TABLE::LINKS_TOTAL + D-1) / D;
|
||||
|
||||
typedef SIMD<int8_t, SIMD_SIZE> TYPE;
|
||||
Rotate<TYPE, D> rotate;
|
||||
|
||||
TYPE bnl[BNL];
|
||||
TYPE msg[MSG];
|
||||
|
|
@ -95,19 +97,6 @@ class LDPCDecoder
|
|||
{
|
||||
return vreinterpret<TYPE>(vand(vmask(b), vorr(vceqz(a), veor(vcgtz(a), vcltz(b)))));
|
||||
}
|
||||
static TYPE rotate(TYPE a, int s)
|
||||
{
|
||||
if (s < 0)
|
||||
s += D;
|
||||
int t = D - s;
|
||||
TYPE ret;
|
||||
// TODO: I can has barrel shifter?
|
||||
for (int n = 0; n < s; ++n)
|
||||
ret.v[n] = a.v[n+t];
|
||||
for (int n = 0; n < t; ++n)
|
||||
ret.v[n+s] = a.v[n];
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool bad()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ Copyright 2018 Ahmet Inan <inan@aicodix.de>
|
|||
|
||||
#include <algorithm>
|
||||
#include "simd.hh"
|
||||
#include "rotate.hh"
|
||||
|
||||
namespace CODE {
|
||||
|
||||
|
|
@ -42,6 +43,7 @@ class LDPCDecoder
|
|||
static const int POS = (TABLE::LINKS_TOTAL - (2*R-1) + D-1) / D;
|
||||
|
||||
typedef SIMD<int8_t, SIMD_SIZE> TYPE;
|
||||
Rotate<TYPE, D> rotate;
|
||||
|
||||
TYPE bnl[BNL];
|
||||
TYPE msg[MSG];
|
||||
|
|
@ -97,19 +99,6 @@ class LDPCDecoder
|
|||
{
|
||||
return vreinterpret<TYPE>(vand(vmask(b), vorr(vceqz(a), veor(vcgtz(a), vcltz(b)))));
|
||||
}
|
||||
static TYPE rotate(TYPE a, int s)
|
||||
{
|
||||
if (s < 0)
|
||||
s += D;
|
||||
int t = D - s;
|
||||
TYPE ret;
|
||||
// TODO: I can has barrel shifter?
|
||||
for (int n = 0; n < s; ++n)
|
||||
ret.v[n] = a.v[n+t];
|
||||
for (int n = 0; n < t; ++n)
|
||||
ret.v[n+s] = a.v[n];
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool bad()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue