libflame
12600
|
00001 /* 00002 libflame 00003 An object-based infrastructure for developing high-performance 00004 dense linear algebra libraries. 00005 00006 Copyright (C) 2011, The University of Texas 00007 00008 libflame is free software; you can redistribute it and/or modify 00009 it under the terms of the GNU Lesser General Public License as 00010 published by the Free Software Foundation; either version 2.1 of 00011 the License, or (at your option) any later version. 00012 00013 libflame is distributed in the hope that it will be useful, but 00014 WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 Lesser General Public License for more details. 00017 00018 You should have received a copy of the GNU Lesser General Public 00019 License along with libflame; if you did not receive a copy, see 00020 http://www.gnu.org/licenses/. 00021 00022 For more information, please contact us at flame@cs.utexas.edu or 00023 send mail to: 00024 00025 Field G. Van Zee and/or 00026 Robert A. van de Geijn 00027 The University of Texas at Austin 00028 Department of Computer Sciences 00029 1 University Station C0500 00030 Austin TX 78712 00031 */ 00032 00033 #include "FLA_type_defs.h" 00034 00035 // --- Pointer-accessing FLAME macro definitions ------------------------------------ 00036 00037 #define FLA_CONSTANT_I_OFFSET 0 00038 #define FLA_CONSTANT_S_OFFSET ( sizeof(double) ) 00039 #define FLA_CONSTANT_D_OFFSET ( sizeof(double) + sizeof(double) ) 00040 #define FLA_CONSTANT_C_OFFSET ( sizeof(double) + sizeof(double) + sizeof(double) ) 00041 #define FLA_CONSTANT_Z_OFFSET ( sizeof(double) + sizeof(double) + sizeof(double) + sizeof( scomplex ) ) 00042 #define FLA_CONSTANT_SIZE ( sizeof(double) + sizeof(double) + sizeof(double) + sizeof( scomplex ) + sizeof( dcomplex ) ) 00043 00044 #define FLA_INT_PTR( x ) \ 00045 ( ((x).base)->datatype == FLA_CONSTANT ? \ 00046 ( ( int * ) ( ( ( char * ) ((x).base)->buffer ) + FLA_CONSTANT_I_OFFSET ) ) : \ 00047 ( ( ( int * ) ((x).base)->buffer ) + ( size_t ) (x).offn * ((x).base)->cs + \ 00048 ( size_t ) (x).offm * ((x).base)->rs ) ) 00049 00050 #define FLA_FLOAT_PTR( x ) \ 00051 ( ((x).base)->datatype == FLA_CONSTANT ? \ 00052 ( ( float * ) ( ( ( char * ) ((x).base)->buffer ) + FLA_CONSTANT_S_OFFSET ) ) : \ 00053 ( ( ( float * ) ((x).base)->buffer ) + ( size_t ) (x).offn * ((x).base)->cs + \ 00054 ( size_t ) (x).offm * ((x).base)->rs ) ) 00055 00056 #define FLA_DOUBLE_PTR( x ) \ 00057 ( ((x).base)->datatype == FLA_CONSTANT ? \ 00058 ( ( double * ) ( ( ( char * ) ((x).base)->buffer ) + FLA_CONSTANT_D_OFFSET ) ) : \ 00059 ( ( ( double * ) ((x).base)->buffer ) + ( size_t ) (x).offn * ((x).base)->cs + \ 00060 ( size_t ) (x).offm * ((x).base)->rs ) ) 00061 00062 #define FLA_COMPLEX_PTR( x ) \ 00063 ( ((x).base)->datatype == FLA_CONSTANT ? \ 00064 ( ( scomplex * ) ( ( ( char * ) ((x).base)->buffer ) + FLA_CONSTANT_C_OFFSET ) ) : \ 00065 ( ( ( scomplex * ) ((x).base)->buffer ) + ( size_t ) (x).offn * ((x).base)->cs + \ 00066 ( size_t ) (x).offm * ((x).base)->rs ) ) 00067 00068 #define FLA_DOUBLE_COMPLEX_PTR( x ) \ 00069 ( ((x).base)->datatype == FLA_CONSTANT ? \ 00070 ( ( dcomplex * ) ( ( ( char * ) ((x).base)->buffer ) + FLA_CONSTANT_Z_OFFSET ) ) : \ 00071 ( ( ( dcomplex * ) ((x).base)->buffer ) + ( size_t ) (x).offn * ((x).base)->cs + \ 00072 ( size_t ) (x).offm * ((x).base)->rs ) ) 00073