cblas: typedef enums for improved compatibility with Intel MKL.
authorZaheer Chothia <zaheer.chothia@gmail.com>
Mon, 25 Jun 2012 11:51:46 +0000 (13:51 +0200)
committerZaheer Chothia <zaheer.chothia@gmail.com>
Sat, 19 Jan 2013 21:57:13 +0000 (22:57 +0100)
Netlib style:
    enum CBLAS_XYZ {X=1, Y=2, Z=3};

Intel MKL style:
    typedef enum {X=1, Y=2, Z=3} CBLAS_XYZ;

With this hybrid style, code written in the latter form won't need any
modifications to be built with OpenBLAS.  This change should not affect existing
code, although a warning may be emitted for C code which does the following
(does not occur with C++):
    typedef enum CBLAS_XYZ CBLAS_XYZ;
    warning: redefinition of typedef 'CBLAS_XYZ' [-pedantic]

cblas.h

diff --git a/cblas.h b/cblas.h
index e9664fe..5d50238 100644 (file)
--- a/cblas.h
+++ b/cblas.h
@@ -18,11 +18,11 @@ char* openblas_get_config(void);
 
 #define CBLAS_INDEX size_t
 
-enum CBLAS_ORDER     {CblasRowMajor=101, CblasColMajor=102};
-enum CBLAS_TRANSPOSE {CblasNoTrans=111, CblasTrans=112, CblasConjTrans=113, CblasConjNoTrans=114};
-enum CBLAS_UPLO      {CblasUpper=121, CblasLower=122};
-enum CBLAS_DIAG      {CblasNonUnit=131, CblasUnit=132};
-enum CBLAS_SIDE      {CblasLeft=141, CblasRight=142};
+typedef enum CBLAS_ORDER     {CblasRowMajor=101, CblasColMajor=102} CBLAS_ORDER;
+typedef enum CBLAS_TRANSPOSE {CblasNoTrans=111, CblasTrans=112, CblasConjTrans=113, CblasConjNoTrans=114} CBLAS_TRANSPOSE;
+typedef enum CBLAS_UPLO      {CblasUpper=121, CblasLower=122} CBLAS_UPLO;
+typedef enum CBLAS_DIAG      {CblasNonUnit=131, CblasUnit=132} CBLAS_DIAG;
+typedef enum CBLAS_SIDE      {CblasLeft=141, CblasRight=142} CBLAS_SIDE;
 
 float  cblas_sdsdot(blasint n, float, float *x, blasint incx, float *y, blasint incy);
 double cblas_dsdot (blasint n, float *x, blasint incx, float *y, blasint incy);