Click here to Skip to main content
15,887,485 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How do I convert x[2][4] to __m128i and vise versa?
see error on main.cpp file
C++
//.h file
#ifndef _SSEEXAMPLE1_H
#define _SSEEXAMPLE1_H
#include <emmintrin.h>
class sseexample1
{
public:
    void charles(__m128i *x, __m128i *y);
};
#endif
//,cpp file
#include "stdafx.h"
#include <stdio.h>
#include <emmintrin.h>
#include "sseexample1.h"
void sseexample1::charles(__m128i* x,__m128i* y)
{
for (int j = 0;j<4;j++)
{
*&y[j] = _mm_add_epi16(*&x[j],*&x[j+1]);
}
}
//main.cpp file
#include "stdafx.h"
#include <stdio.h>
#include <emmintrin.h>
#include "sseexample1.h"
#include <iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
    int x[2][4]={1,1,1,1,2,2,2,2};
    int y[2][4];
    sseexample1 z;
    z.charles(x,y);//error C2664: 'sseexample1::charles' : cannot convert parameter 1 from 'int [2][4]' to '__m128i *'
    for (int j = 0; j < 4; j++)
        cout << y[j] << " ";
          cout << endl;
    return 0;
}
Posted
Updated 27-Jul-10 17:52pm
v3

1 solution

This way:

C++
z.charles((__m128i *)x, (__m128i *)y);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900