diff --git a/CBLAS/src/cblas_cgbmv.c b/CBLAS/src/cblas_cgbmv.c index 28abf9493..776fcbc7e 100644 --- a/CBLAS/src/cblas_cgbmv.c +++ b/CBLAS/src/cblas_cgbmv.c @@ -7,6 +7,8 @@ */ #include #include +#include + #include "cblas.h" #include "cblas_f77.h" void API_SUFFIX(cblas_cgbmv)(const CBLAS_LAYOUT layout, @@ -26,6 +28,7 @@ void API_SUFFIX(cblas_cgbmv)(const CBLAS_LAYOUT layout, F77_INT F77_M=M, F77_N=N, F77_lda=lda, F77_incX=incX, F77_incY=incY; F77_INT F77_KL=KL,F77_KU=KU; #else + CBLAS_INT incx=incX; #define F77_M M #define F77_N N #define F77_lda lda @@ -34,15 +37,19 @@ void API_SUFFIX(cblas_cgbmv)(const CBLAS_LAYOUT layout, #define F77_incX incx #define F77_incY incY #endif - CBLAS_INT n=0, i=0, incx=incX; - const float *xx= (float *)X, *alp= (float *)alpha, *bet = (float *)beta; + CBLAS_INT n=0, i=0; + const float *xx= (const float *)X, *alp= (const float *)alpha, *bet = (const float *)beta; float ALPHA[2],BETA[2]; CBLAS_INT tincY, tincx; - float *x=(float *)X, *y=(float *)Y, *st=0, *tx=0; + float *x, *y, *st=0, *tx=0; extern int CBLAS_CallFromC; extern int RowMajorStrg; RowMajorStrg = 0; + memcpy(&x, &X, sizeof(float*)); + memcpy(&y, &Y, sizeof(float*)); + + CBLAS_CallFromC = 1; if (layout == CblasColMajor) { @@ -125,7 +132,7 @@ void API_SUFFIX(cblas_cgbmv)(const CBLAS_LAYOUT layout, y -= n; } } - else x = (float *) X; + else memcpy(&x, &X, sizeof(float*)); } diff --git a/CBLAS/src/cblas_cgemv.c b/CBLAS/src/cblas_cgemv.c index 011bd60db..a9a27f456 100644 --- a/CBLAS/src/cblas_cgemv.c +++ b/CBLAS/src/cblas_cgemv.c @@ -7,6 +7,7 @@ */ #include #include +#include #include "cblas.h" #include "cblas_f77.h" void API_SUFFIX(cblas_cgemv)(const CBLAS_LAYOUT layout, @@ -31,18 +32,22 @@ void API_SUFFIX(cblas_cgemv)(const CBLAS_LAYOUT layout, #define F77_incY incY #endif - CBLAS_INT n=0, i=0, incx=incX; + CBLAS_INT n=0, i=0; const float *xx= (const float *)X; float ALPHA[2],BETA[2]; CBLAS_INT tincY, tincx; - float *x=(float *)X, *y=(float *)Y, *st=0, *tx=0; - const float *stx = x; + float *x, *y, *st=0, *tx=0; extern int CBLAS_CallFromC; extern int RowMajorStrg; RowMajorStrg = 0; CBLAS_CallFromC = 1; + memcpy(&x, &X, sizeof(float *)); + memcpy(&y, &Y, sizeof(float *)); + + const float *stx = x; + if (layout == CblasColMajor) { if (TransA == CblasNoTrans) TA = 'N'; diff --git a/CBLAS/src/cblas_cgerc.c b/CBLAS/src/cblas_cgerc.c index 905e32ae4..f9e4af33c 100644 --- a/CBLAS/src/cblas_cgerc.c +++ b/CBLAS/src/cblas_cgerc.c @@ -7,6 +7,8 @@ */ #include #include +#include + #include "cblas.h" #include "cblas_f77.h" void API_SUFFIX(cblas_cgerc)(const CBLAS_LAYOUT layout, const CBLAS_INT M, const CBLAS_INT N, @@ -16,6 +18,7 @@ void API_SUFFIX(cblas_cgerc)(const CBLAS_LAYOUT layout, const CBLAS_INT M, const #ifdef F77_INT F77_INT F77_M=M, F77_N=N, F77_lda=lda, F77_incX=incX, F77_incY=incY; #else + CBLAS_INT incy = incY; #define F77_M M #define F77_N N #define F77_incX incX @@ -23,8 +26,10 @@ void API_SUFFIX(cblas_cgerc)(const CBLAS_LAYOUT layout, const CBLAS_INT M, const #define F77_lda lda #endif - CBLAS_INT n, i, tincy, incy=incY; - float *y=(float *)Y, *yy=(float *)Y, *ty, *st; + CBLAS_INT n, i, tincy; + float *y, *yy, *ty, *st; + memcpy(&y,&Y,sizeof(float*)); + memcpy(&yy,&Y,sizeof(float*)); extern int CBLAS_CallFromC; extern int RowMajorStrg; @@ -70,7 +75,8 @@ void API_SUFFIX(cblas_cgerc)(const CBLAS_LAYOUT layout, const CBLAS_INT M, const incy = 1; #endif } - else y = (float *) Y; + else + memcpy(&y,&Y,sizeof(float*)); F77_cgeru( &F77_N, &F77_M, alpha, y, &F77_incY, X, &F77_incX, A, &F77_lda); diff --git a/CBLAS/src/cblas_chbmv.c b/CBLAS/src/cblas_chbmv.c index 9b3c53d27..5fab2022c 100644 --- a/CBLAS/src/cblas_chbmv.c +++ b/CBLAS/src/cblas_chbmv.c @@ -9,6 +9,7 @@ #include "cblas_f77.h" #include #include +#include void API_SUFFIX(cblas_chbmv)(const CBLAS_LAYOUT layout, const CBLAS_UPLO Uplo,const CBLAS_INT N,const CBLAS_INT K, const void *alpha, const void *A, const CBLAS_INT lda, @@ -24,21 +25,25 @@ void API_SUFFIX(cblas_chbmv)(const CBLAS_LAYOUT layout, #ifdef F77_INT F77_INT F77_N=N, F77_K=K, F77_lda=lda, F77_incX=incX, F77_incY=incY; #else + CBLAS_INT incx = incX; #define F77_N N #define F77_K K #define F77_lda lda #define F77_incX incx #define F77_incY incY #endif - CBLAS_INT n, i=0, incx=incX; - const float *xx= (float *)X, *alp= (float *)alpha, *bet = (float *)beta; + CBLAS_INT n, i=0; + const float *xx= (const float *)X, *alp= (const float *)alpha, *bet = (const float *)beta; float ALPHA[2],BETA[2]; CBLAS_INT tincY, tincx; - float *x=(float *)X, *y=(float *)Y, *st=0, *tx; + float *x, *y, *st=0, *tx; extern int CBLAS_CallFromC; extern int RowMajorStrg; RowMajorStrg = 0; + memcpy(&x, &X, sizeof(float*)); + memcpy(&y, &Y, sizeof(float*)); + CBLAS_CallFromC = 1; if (layout == CblasColMajor) { @@ -114,7 +119,7 @@ void API_SUFFIX(cblas_chbmv)(const CBLAS_LAYOUT layout, } while(y != st); y -= n; } else - x = (float *) X; + memcpy(&x, &X, sizeof(float*)); if (Uplo == CblasUpper) UL = 'L'; else if (Uplo == CblasLower) UL = 'U'; diff --git a/CBLAS/src/cblas_chemv.c b/CBLAS/src/cblas_chemv.c index 29a224b02..fd092be66 100644 --- a/CBLAS/src/cblas_chemv.c +++ b/CBLAS/src/cblas_chemv.c @@ -7,6 +7,8 @@ */ #include #include +#include + #include "cblas.h" #include "cblas_f77.h" void API_SUFFIX(cblas_chemv)(const CBLAS_LAYOUT layout, @@ -24,20 +26,24 @@ void API_SUFFIX(cblas_chemv)(const CBLAS_LAYOUT layout, #ifdef F77_INT F77_INT F77_N=N, F77_lda=lda, F77_incX=incX, F77_incY=incY; #else + CBLAS_INT incx = incX; #define F77_N N #define F77_lda lda #define F77_incX incx #define F77_incY incY #endif - CBLAS_INT n=0, i=0, incx=incX; - const float *xx= (float *)X, *alp= (float *)alpha, *bet = (float *)beta; + CBLAS_INT n=0, i=0; + const float *xx= (const float *)X, *alp= (const float *)alpha, *bet = (const float *)beta; float ALPHA[2],BETA[2]; CBLAS_INT tincY, tincx; - float *x=(float *)X, *y=(float *)Y, *st=0, *tx; + float *x, *y, *st=0, *tx; extern int CBLAS_CallFromC; extern int RowMajorStrg; RowMajorStrg = 0; + memcpy(&x, &X, sizeof(float*)); + memcpy(&y, &Y, sizeof(float*)); + CBLAS_CallFromC = 1; if (layout == CblasColMajor) @@ -114,7 +120,7 @@ void API_SUFFIX(cblas_chemv)(const CBLAS_LAYOUT layout, } while(y != st); y -= n; } else - x = (float *) X; + memcpy(&x, &X, sizeof(float*)); if (Uplo == CblasUpper) UL = 'L'; diff --git a/CBLAS/src/cblas_cher.c b/CBLAS/src/cblas_cher.c index a87f9f60c..a5da13ba0 100644 --- a/CBLAS/src/cblas_cher.c +++ b/CBLAS/src/cblas_cher.c @@ -7,6 +7,7 @@ */ #include #include +#include #include "cblas.h" #include "cblas_f77.h" void API_SUFFIX(cblas_cher)(const CBLAS_LAYOUT layout, const CBLAS_UPLO Uplo, @@ -23,17 +24,22 @@ void API_SUFFIX(cblas_cher)(const CBLAS_LAYOUT layout, const CBLAS_UPLO Uplo, #ifdef F77_INT F77_INT F77_N=N, F77_lda=lda, F77_incX=incX; #else + CBLAS_INT incx; #define F77_N N #define F77_lda lda #define F77_incX incx #endif - CBLAS_INT n, i, tincx, incx=incX; - float *x=(float *)X, *xx=(float *)X, *tx, *st; + CBLAS_INT n, i, tincx; + float *x, *xx, *tx, *st; extern int CBLAS_CallFromC; extern int RowMajorStrg; RowMajorStrg = 0; + memcpy(&x,&X,sizeof(float*)); + memcpy(&xx,&X,sizeof(float*)); + + CBLAS_CallFromC = 1; if (layout == CblasColMajor) { @@ -98,7 +104,9 @@ void API_SUFFIX(cblas_cher)(const CBLAS_LAYOUT layout, const CBLAS_UPLO Uplo, incx = 1; #endif } - else x = (float *) X; + else + memcpy(&x,&X,sizeof(float*)); + F77_cher(F77_UL, &F77_N, &alpha, x, &F77_incX, A, &F77_lda); } else { diff --git a/CBLAS/src/cblas_cher2.c b/CBLAS/src/cblas_cher2.c index 25fe871aa..f66c93e3d 100644 --- a/CBLAS/src/cblas_cher2.c +++ b/CBLAS/src/cblas_cher2.c @@ -7,6 +7,7 @@ */ #include #include +#include #include "cblas.h" #include "cblas_f77.h" void API_SUFFIX(cblas_cher2)(const CBLAS_LAYOUT layout, const CBLAS_UPLO Uplo, @@ -23,19 +24,25 @@ void API_SUFFIX(cblas_cher2)(const CBLAS_LAYOUT layout, const CBLAS_UPLO Uplo, #ifdef F77_INT F77_INT F77_N=N, F77_lda=lda, F77_incX=incX, F77_incY=incY; #else + CBLAS_INT incx = incX, incy = incY; #define F77_N N #define F77_lda lda #define F77_incX incx #define F77_incY incy #endif - CBLAS_INT n, i, j, tincx, tincy, incx=incX, incy=incY; - float *x=(float *)X, *xx=(float *)X, *y=(float *)Y, - *yy=(float *)Y, *tx, *ty, *stx, *sty; + CBLAS_INT n, i, j, tincx, tincy; + float *x, *xx, *y, + *yy, *tx, *ty, *stx, *sty; extern int CBLAS_CallFromC; extern int RowMajorStrg; RowMajorStrg = 0; + memcpy(&x,&X,sizeof(float*)); + memcpy(&xx,&X,sizeof(float*)); + memcpy(&y,&Y,sizeof(float*)); + memcpy(&yy,&Y,sizeof(float*)); + CBLAS_CallFromC = 1; if (layout == CblasColMajor) { @@ -129,8 +136,8 @@ void API_SUFFIX(cblas_cher2)(const CBLAS_LAYOUT layout, const CBLAS_UPLO Uplo, #endif } else { - x = (float *) X; - y = (float *) Y; + memcpy(&x,&X,sizeof(float*)); + memcpy(&y,&Y,sizeof(float*)); } F77_cher2(F77_UL, &F77_N, alpha, y, &F77_incY, x, &F77_incX, A, &F77_lda); diff --git a/CBLAS/src/cblas_cher2k.c b/CBLAS/src/cblas_cher2k.c index 31c81ac8a..a4e24abfa 100644 --- a/CBLAS/src/cblas_cher2k.c +++ b/CBLAS/src/cblas_cher2k.c @@ -37,7 +37,7 @@ void API_SUFFIX(cblas_cher2k)(const CBLAS_LAYOUT layout, const CBLAS_UPLO Uplo, extern int CBLAS_CallFromC; extern int RowMajorStrg; float ALPHA[2]; - const float *alp=(float *)alpha; + const float *alp=(const float *)alpha; CBLAS_CallFromC = 1; RowMajorStrg = 0; diff --git a/CBLAS/src/cblas_chpmv.c b/CBLAS/src/cblas_chpmv.c index 06573105f..6c8e829de 100644 --- a/CBLAS/src/cblas_chpmv.c +++ b/CBLAS/src/cblas_chpmv.c @@ -7,6 +7,8 @@ */ #include #include +#include + #include "cblas.h" #include "cblas_f77.h" void API_SUFFIX(cblas_chpmv)(const CBLAS_LAYOUT layout, @@ -24,19 +26,24 @@ void API_SUFFIX(cblas_chpmv)(const CBLAS_LAYOUT layout, #ifdef F77_INT F77_INT F77_N=N, F77_incX=incX, F77_incY=incY; #else + CBLAS_INT incx = incX; #define F77_N N #define F77_incX incx #define F77_incY incY #endif - CBLAS_INT n, i=0, incx=incX; - const float *xx= (float *)X, *alp= (float *)alpha, *bet = (float *)beta; + CBLAS_INT n, i=0; + const float *xx= (const float *)X, *alp= (const float *)alpha, *bet = (const float *)beta; float ALPHA[2],BETA[2]; CBLAS_INT tincY, tincx; - float *x=(float *)X, *y=(float *)Y, *st=0, *tx; + float *x, *y, *st=0, *tx; extern int CBLAS_CallFromC; extern int RowMajorStrg; RowMajorStrg = 0; + memcpy(&x,&X,sizeof(float*)); + memcpy(&y,&Y,sizeof(float*)); + + CBLAS_CallFromC = 1; if (layout == CblasColMajor) { @@ -112,8 +119,7 @@ void API_SUFFIX(cblas_chpmv)(const CBLAS_LAYOUT layout, } while(y != st); y -= n; } else - x = (float *) X; - + memcpy(&x,&X,sizeof(float*)); if (Uplo == CblasUpper) UL = 'L'; else if (Uplo == CblasLower) UL = 'U'; diff --git a/CBLAS/src/cblas_chpr.c b/CBLAS/src/cblas_chpr.c index 5ec037ce4..ff4220690 100644 --- a/CBLAS/src/cblas_chpr.c +++ b/CBLAS/src/cblas_chpr.c @@ -7,6 +7,8 @@ */ #include #include +#include + #include "cblas.h" #include "cblas_f77.h" void API_SUFFIX(cblas_chpr)(const CBLAS_LAYOUT layout, const CBLAS_UPLO Uplo, @@ -23,16 +25,20 @@ void API_SUFFIX(cblas_chpr)(const CBLAS_LAYOUT layout, const CBLAS_UPLO Uplo, #ifdef F77_INT F77_INT F77_N=N, F77_incX=incX; #else + CBLAS_INT incx = incX; #define F77_N N #define F77_incX incx #endif - CBLAS_INT n, i, tincx, incx=incX; - float *x=(float *)X, *xx=(float *)X, *tx, *st; + CBLAS_INT n, i, tincx; + float *x, *xx, *tx, *st; extern int CBLAS_CallFromC; extern int RowMajorStrg; RowMajorStrg = 0; + memcpy(&x,&X,sizeof(float*)); + memcpy(&xx,&X,sizeof(float*)); + CBLAS_CallFromC = 1; if (layout == CblasColMajor) { @@ -96,7 +102,8 @@ void API_SUFFIX(cblas_chpr)(const CBLAS_LAYOUT layout, const CBLAS_UPLO Uplo, incx = 1; #endif } - else x = (float *) X; + else + memcpy(&x,&X,sizeof(float*)); F77_chpr(F77_UL, &F77_N, &alpha, x, &F77_incX, A); diff --git a/CBLAS/src/cblas_chpr2.c b/CBLAS/src/cblas_chpr2.c index 03ec32205..435738a1c 100644 --- a/CBLAS/src/cblas_chpr2.c +++ b/CBLAS/src/cblas_chpr2.c @@ -7,6 +7,7 @@ */ #include #include +#include #include "cblas.h" #include "cblas_f77.h" void API_SUFFIX(cblas_chpr2)(const CBLAS_LAYOUT layout, const CBLAS_UPLO Uplo, @@ -24,18 +25,25 @@ void API_SUFFIX(cblas_chpr2)(const CBLAS_LAYOUT layout, const CBLAS_UPLO Uplo, #ifdef F77_INT F77_INT F77_N=N, F77_incX=incX, F77_incY=incY; #else + CBLAS_INT incx = incX; + CBLAS_INT incy = incY; #define F77_N N #define F77_incX incx #define F77_incY incy #endif - CBLAS_INT n, i, j, tincx, tincy, incx=incX, incy=incY; - float *x=(float *)X, *xx=(float *)X, *y=(float *)Y, - *yy=(float *)Y, *tx, *ty, *stx, *sty; + CBLAS_INT n, i, j, tincx, tincy; + float *x, *xx, *y, + *yy, *tx, *ty, *stx, *sty; extern int CBLAS_CallFromC; extern int RowMajorStrg; RowMajorStrg = 0; + memcpy(&x,&X,sizeof(float*)); + memcpy(&xx,&X,sizeof(float*)); + memcpy(&y,&Y,sizeof(float*)); + memcpy(&yy,&Y,sizeof(float*)); + CBLAS_CallFromC = 1; if (layout == CblasColMajor) { @@ -128,8 +136,8 @@ void API_SUFFIX(cblas_chpr2)(const CBLAS_LAYOUT layout, const CBLAS_UPLO Uplo, } else { - x = (float *) X; - y = (void *) Y; + memcpy(&x,&X,sizeof(float*)); + memcpy(&y,&Y,sizeof(float*)); } F77_chpr2(F77_UL, &F77_N, alpha, y, &F77_incY, x, &F77_incX, Ap); } else diff --git a/CBLAS/src/cblas_zher2k.c b/CBLAS/src/cblas_zher2k.c index b6a2142e8..31a82974c 100644 --- a/CBLAS/src/cblas_zher2k.c +++ b/CBLAS/src/cblas_zher2k.c @@ -37,7 +37,7 @@ void API_SUFFIX(cblas_zher2k)(const CBLAS_LAYOUT layout, const CBLAS_UPLO Uplo, extern int CBLAS_CallFromC; extern int RowMajorStrg; double ALPHA[2]; - const double *alp=(double *)alpha; + const double *alp=(const double *)alpha; CBLAS_CallFromC = 1; RowMajorStrg = 0;