This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Endianness vtbx

Hi @ all,

I have a 16 byte permutation mask uint8_t[16] and a 16 byte data array uint32_t[4]. I want to "shuffle" this data array using vtbx.

This is my code so far:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <arm_neon.h>
#include <iostream>
int main() {
uint32_t* data32 = new uint32_t[4];
data32[0] = 2570;
data32[1] = 655370;
data32[2] = 168430090;
data32[3] = 10;
//load structure
uint32x4_t data32Vec = vld1q_u32(data32);
uint8_t* sMask = new uint8_t[16];
sMask[0] = 2;
sMask[1] = 3;
sMask[2] = 5;
sMask[3] = 6;
sMask[4] = 7;
sMask[5] = 8;
sMask[6] = 9;
sMask[7] = 10;
sMask[8] = 11;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

 

The output looks like the following:

Fullscreen
1
2
3
4
5
6
7
8
0 10
0 0
0 162 #<-- this value [162] changes from everytime i run the code
10 190
0 0
10 0
10 0
10 0
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

But it should look like that:

Fullscreen
1
2
3
4
5
6
7
8
10 10
10 10
10 0
0 0
10 0
10 0
10 0
10 0
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 

I think it has something to do with endianness, but just don't see the problem. Does anyone has a hint?

 

Sincerely

0