mirror of
https://github.com/aicodix/code.git
synced 2026-04-27 14:30:36 +00:00
added code to explain rotate.hh
This commit is contained in:
parent
c7769bb1ec
commit
2b25cd3dcc
1 changed files with 13 additions and 1 deletions
14
README.md
14
README.md
|
|
@ -89,5 +89,17 @@ Single instruction, multiple data ([SIMD](https://en.wikipedia.org/wiki/SIMD)) w
|
|||
|
||||
### [rotate.hh](rotate.hh)
|
||||
|
||||
([SIMD](https://en.wikipedia.org/wiki/SIMD)) element wise horizontal rotation
|
||||
[SIMD](https://en.wikipedia.org/wiki/SIMD) element wise horizontal rotation
|
||||
|
||||
It computes the following, but faster:
|
||||
|
||||
```
|
||||
SIMD<int8_t, SIZE> rotate(SIMD<int8_t, SIZE> input, int shift, int WIDTH)
|
||||
{
|
||||
SIMD<int8_t, SIZE> output;
|
||||
for (int n = 0; n < WIDTH; ++n)
|
||||
output.v[(n + shift + WIDTH) % WIDTH] = input.v[n];
|
||||
return output;
|
||||
}
|
||||
```
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue