Explicitly typecast return vals in static funcs.

Details:
- Added explicit typecasting to various functions (mostly static
  functions), primarily those in bli_param_macro_defs.h,
  bli_obj_macro_defs.h, bli_cntx.h, bli_cntl.h, and a few other header
  files.
- This change was prompted by feedback from Jacob Gorm Hansen, who
  reported that #including "blis.h" from his application caused a
  gcc to output error messages (relating to types being returned
  mismatching the declared return types) when used via the C++ compiler
  front-end. This is the first pass of fixes, and we may need to
  iterate with additional follow-up commits (#233).
This commit is contained in:
Field G. Van Zee
2018-07-19 11:14:30 -05:00
parent fa08e5ead9
commit b7db293323
9 changed files with 462 additions and 250 deletions

View File

@@ -43,362 +43,433 @@
static num_t bli_obj_dt( obj_t* obj )
{
return ( obj->info & BLIS_DATATYPE_BITS );
return ( num_t )
( obj->info & BLIS_DATATYPE_BITS );
}
static bool_t bli_obj_is_float( obj_t* obj )
{
return ( bli_obj_dt( obj ) == BLIS_BITVAL_FLOAT_TYPE );
return ( bool_t )
( bli_obj_dt( obj ) == BLIS_BITVAL_FLOAT_TYPE );
}
static bool_t bli_obj_is_double( obj_t* obj )
{
return ( bli_obj_dt( obj ) == BLIS_BITVAL_DOUBLE_TYPE );
return ( bool_t )
( bli_obj_dt( obj ) == BLIS_BITVAL_DOUBLE_TYPE );
}
static bool_t bli_obj_is_scomplex( obj_t* obj )
{
return ( bli_obj_dt( obj ) == BLIS_BITVAL_SCOMPLEX_TYPE );
return ( bool_t )
( bli_obj_dt( obj ) == BLIS_BITVAL_SCOMPLEX_TYPE );
}
static bool_t bli_obj_is_dcomplex( obj_t* obj )
{
return ( bli_obj_dt( obj ) == BLIS_BITVAL_DCOMPLEX_TYPE );
return ( bool_t )
( bli_obj_dt( obj ) == BLIS_BITVAL_DCOMPLEX_TYPE );
}
static bool_t bli_obj_is_int( obj_t* obj )
{
return ( bli_obj_dt( obj ) == BLIS_BITVAL_INT_TYPE );
return ( bool_t )
( bli_obj_dt( obj ) == BLIS_BITVAL_INT_TYPE );
}
static bool_t bli_obj_is_const( obj_t* obj )
{
return ( bli_obj_dt( obj ) == BLIS_BITVAL_CONST_TYPE );
return ( bool_t )
( bli_obj_dt( obj ) == BLIS_BITVAL_CONST_TYPE );
}
static dom_t bli_obj_domain( obj_t* obj )
{
return ( obj->info & BLIS_DOMAIN_BIT );
return ( dom_t )
( obj->info & BLIS_DOMAIN_BIT );
}
static prec_t bli_obj_prec( obj_t* obj )
{
return ( obj->info & BLIS_PRECISION_BIT );
return ( prec_t )
( obj->info & BLIS_PRECISION_BIT );
}
static bool_t bli_obj_is_single_prec( obj_t* obj )
{
return ( bli_obj_prec( obj ) == BLIS_BITVAL_SINGLE_PREC );
return ( bool_t )
( bli_obj_prec( obj ) == BLIS_BITVAL_SINGLE_PREC );
}
static bool_t bli_obj_is_double_prec( obj_t* obj )
{
return ( bli_obj_prec( obj ) == BLIS_BITVAL_DOUBLE_PREC );
return ( bool_t )
( bli_obj_prec( obj ) == BLIS_BITVAL_DOUBLE_PREC );
}
static num_t bli_obj_dt_proj_to_single_prec( obj_t* obj )
{
return ( bli_obj_dt( obj ) & ~BLIS_BITVAL_SINGLE_PREC );
return ( num_t )
( bli_obj_dt( obj ) & ~BLIS_BITVAL_SINGLE_PREC );
}
static num_t bli_obj_dt_proj_to_double_prec( obj_t* obj )
{
return ( bli_obj_dt( obj ) | BLIS_BITVAL_DOUBLE_PREC );
return ( num_t )
( bli_obj_dt( obj ) | BLIS_BITVAL_DOUBLE_PREC );
}
static bool_t bli_obj_is_real( obj_t* obj )
{
return ( bli_obj_domain( obj ) == BLIS_BITVAL_REAL );
return ( bool_t )
( bli_obj_domain( obj ) == BLIS_BITVAL_REAL );
}
static bool_t bli_obj_is_complex( obj_t* obj )
{
return ( bli_obj_domain( obj ) == BLIS_BITVAL_COMPLEX );
return ( bool_t )
( bli_obj_domain( obj ) == BLIS_BITVAL_COMPLEX );
}
static num_t bli_obj_dt_proj_to_real( obj_t* obj )
{
return ( bli_obj_dt( obj ) & ~BLIS_BITVAL_COMPLEX );
return ( num_t )
( bli_obj_dt( obj ) & ~BLIS_BITVAL_COMPLEX );
}
static num_t bli_obj_dt_proj_to_complex( obj_t* obj )
{
return ( bli_obj_dt( obj ) | BLIS_BITVAL_COMPLEX );
return ( num_t )
( bli_obj_dt( obj ) | BLIS_BITVAL_COMPLEX );
}
static num_t bli_obj_target_dt( obj_t* obj )
{
return ( ( obj->info & BLIS_TARGET_DT_BITS ) >> BLIS_TARGET_DT_SHIFT );
return ( num_t )
( ( obj->info & BLIS_TARGET_DT_BITS ) >> BLIS_TARGET_DT_SHIFT );
}
static dom_t bli_obj_target_domain( obj_t* obj )
{
return ( ( obj->info & BLIS_TARGET_DOMAIN_BIT ) >> BLIS_TARGET_DT_SHIFT );
return ( dom_t )
( ( obj->info & BLIS_TARGET_DOMAIN_BIT ) >> BLIS_TARGET_DT_SHIFT );
}
static prec_t bli_obj_target_prec( obj_t* obj )
{
return ( ( obj->info & BLIS_TARGET_PREC_BIT ) >> BLIS_TARGET_DT_SHIFT );
return ( prec_t )
( ( obj->info & BLIS_TARGET_PREC_BIT ) >> BLIS_TARGET_DT_SHIFT );
}
static num_t bli_obj_exec_dt( obj_t* obj )
{
return ( ( obj->info & BLIS_EXEC_DT_BITS ) >> BLIS_EXEC_DT_SHIFT );
return ( num_t )
( ( obj->info & BLIS_EXEC_DT_BITS ) >> BLIS_EXEC_DT_SHIFT );
}
static dom_t bli_obj_exec_domain( obj_t* obj )
{
return ( ( obj->info & BLIS_EXEC_DOMAIN_BIT ) >> BLIS_EXEC_DT_SHIFT );
return ( dom_t )
( ( obj->info & BLIS_EXEC_DOMAIN_BIT ) >> BLIS_EXEC_DT_SHIFT );
}
static prec_t bli_obj_exec_prec( obj_t* obj )
{
return ( ( obj->info & BLIS_EXEC_PREC_BIT ) >> BLIS_EXEC_DT_SHIFT );
return ( prec_t )
( ( obj->info & BLIS_EXEC_PREC_BIT ) >> BLIS_EXEC_DT_SHIFT );
}
static trans_t bli_obj_conjtrans_status( obj_t* obj )
{
return ( obj->info & BLIS_CONJTRANS_BITS );
return ( trans_t )
( obj->info & BLIS_CONJTRANS_BITS );
}
static trans_t bli_obj_onlytrans_status( obj_t* obj )
{
return ( obj->info & BLIS_TRANS_BIT );
return ( trans_t )
( obj->info & BLIS_TRANS_BIT );
}
static bool_t bli_obj_has_trans( obj_t* obj )
{
return ( bli_obj_onlytrans_status( obj ) == BLIS_BITVAL_TRANS );
return ( bool_t )
( bli_obj_onlytrans_status( obj ) == BLIS_BITVAL_TRANS );
}
static bool_t bli_obj_has_notrans( obj_t* obj )
{
return ( bli_obj_onlytrans_status( obj ) == BLIS_BITVAL_NO_TRANS );
return ( bool_t )
( bli_obj_onlytrans_status( obj ) == BLIS_BITVAL_NO_TRANS );
}
static conj_t bli_obj_conj_status( obj_t* obj )
{
return ( obj->info & BLIS_CONJ_BIT );
return ( conj_t )
( obj->info & BLIS_CONJ_BIT );
}
static bool_t bli_obj_has_conj( obj_t* obj )
{
return ( bli_obj_conj_status( obj ) == BLIS_BITVAL_CONJ );
return ( bool_t )
( bli_obj_conj_status( obj ) == BLIS_BITVAL_CONJ );
}
static bool_t bli_obj_has_noconj( obj_t* obj )
{
return ( bli_obj_conj_status( obj ) == BLIS_BITVAL_NO_CONJ );
return ( bool_t )
( bli_obj_conj_status( obj ) == BLIS_BITVAL_NO_CONJ );
}
static uplo_t bli_obj_uplo( obj_t* obj )
{
return ( obj->info & BLIS_UPLO_BITS );
return ( uplo_t )
( obj->info & BLIS_UPLO_BITS );
}
static bool_t bli_obj_is_upper( obj_t* obj )
{
return ( bli_obj_uplo( obj ) == BLIS_BITVAL_UPPER );
return ( bool_t )
( bli_obj_uplo( obj ) == BLIS_BITVAL_UPPER );
}
static bool_t bli_obj_is_lower( obj_t* obj )
{
return ( bli_obj_uplo( obj ) == BLIS_BITVAL_LOWER );
return ( bool_t )
( bli_obj_uplo( obj ) == BLIS_BITVAL_LOWER );
}
static bool_t bli_obj_is_upper_or_lower( obj_t* obj )
{
return ( bli_obj_is_upper( obj ) ||
return ( bool_t )
( bli_obj_is_upper( obj ) ||
bli_obj_is_lower( obj ) );
}
static bool_t bli_obj_is_dense( obj_t* obj )
{
return ( bli_obj_uplo( obj ) == BLIS_BITVAL_DENSE );
return ( bool_t )
( bli_obj_uplo( obj ) == BLIS_BITVAL_DENSE );
}
static bool_t bli_obj_is_zeros( obj_t* obj )
{
return ( bli_obj_uplo( obj ) == BLIS_BITVAL_ZEROS );
return ( bool_t )
( bli_obj_uplo( obj ) == BLIS_BITVAL_ZEROS );
}
static diag_t bli_obj_diag( obj_t* obj )
{
return ( obj->info & BLIS_UNIT_DIAG_BIT );
return ( diag_t )
( obj->info & BLIS_UNIT_DIAG_BIT );
}
static bool_t bli_obj_has_nonunit_diag( obj_t* obj )
{
return ( bli_obj_diag( obj ) == BLIS_BITVAL_NONUNIT_DIAG );
return ( bool_t )
( bli_obj_diag( obj ) == BLIS_BITVAL_NONUNIT_DIAG );
}
static bool_t bli_obj_has_unit_diag( obj_t* obj )
{
return ( bli_obj_diag( obj ) == BLIS_BITVAL_UNIT_DIAG );
return ( bool_t )
( bli_obj_diag( obj ) == BLIS_BITVAL_UNIT_DIAG );
}
static bool_t bli_obj_has_inverted_diag( obj_t* obj )
{
return ( ( obj->info & BLIS_INVERT_DIAG_BIT ) == BLIS_BITVAL_INVERT_DIAG );
return ( bool_t )
( ( obj->info & BLIS_INVERT_DIAG_BIT ) == BLIS_BITVAL_INVERT_DIAG );
}
static bool_t bli_obj_is_pack_rev_if_upper( obj_t* obj )
{
return ( ( obj->info & BLIS_PACK_REV_IF_UPPER_BIT ) == BLIS_BITVAL_PACK_REV_IF_UPPER );
return ( bool_t )
( ( obj->info & BLIS_PACK_REV_IF_UPPER_BIT ) == BLIS_BITVAL_PACK_REV_IF_UPPER );
}
static bool_t bli_obj_is_pack_rev_if_lower( obj_t* obj )
{
return ( ( obj->info & BLIS_PACK_REV_IF_LOWER_BIT ) == BLIS_BITVAL_PACK_REV_IF_LOWER );
return ( bool_t )
( ( obj->info & BLIS_PACK_REV_IF_LOWER_BIT ) == BLIS_BITVAL_PACK_REV_IF_LOWER );
}
static pack_t bli_obj_pack_schema( obj_t* obj )
{
return ( obj->info & BLIS_PACK_SCHEMA_BITS );
return ( pack_t )
( obj->info & BLIS_PACK_SCHEMA_BITS );
}
static bool_t bli_obj_is_packed( obj_t* obj )
{
return ( obj->info & BLIS_PACK_BIT );
return ( bool_t )
( obj->info & BLIS_PACK_BIT );
}
static bool_t bli_obj_is_row_packed( obj_t* obj )
{
return ( obj->info & BLIS_PACK_RC_BIT ) == ( BLIS_BITVAL_PACKED_UNSPEC ^
return ( bool_t )
( obj->info & BLIS_PACK_RC_BIT ) == ( BLIS_BITVAL_PACKED_UNSPEC ^
BLIS_BITVAL_PACKED_ROWS );
}
static bool_t bli_obj_is_col_packed( obj_t* obj )
{
return ( obj->info & BLIS_PACK_RC_BIT ) == ( BLIS_BITVAL_PACKED_UNSPEC ^
return ( bool_t )
( obj->info & BLIS_PACK_RC_BIT ) == ( BLIS_BITVAL_PACKED_UNSPEC ^
BLIS_BITVAL_PACKED_COLUMNS );
}
static bool_t bli_obj_is_panel_packed( obj_t* obj )
{
return ( obj->info & BLIS_PACK_PANEL_BIT );
return ( bool_t )
( obj->info & BLIS_PACK_PANEL_BIT );
}
static packbuf_t bli_obj_pack_buffer_type( obj_t* obj )
{
return ( obj->info & BLIS_PACK_BUFFER_BITS );
return ( packbuf_t )
( obj->info & BLIS_PACK_BUFFER_BITS );
}
static struc_t bli_obj_struc( obj_t* obj )
{
return ( obj->info & BLIS_STRUC_BITS );
return ( struc_t )
( obj->info & BLIS_STRUC_BITS );
}
static bool_t bli_obj_is_general( obj_t* obj )
{
return ( bli_obj_struc( obj ) == BLIS_BITVAL_GENERAL );
return ( bool_t )
( bli_obj_struc( obj ) == BLIS_BITVAL_GENERAL );
}
static bool_t bli_obj_is_hermitian( obj_t* obj )
{
return ( bli_obj_struc( obj ) == BLIS_BITVAL_HERMITIAN );
return ( bool_t )
( bli_obj_struc( obj ) == BLIS_BITVAL_HERMITIAN );
}
static bool_t bli_obj_is_symmetric( obj_t* obj )
{
return ( bli_obj_struc( obj ) == BLIS_BITVAL_SYMMETRIC );
return ( bool_t )
( bli_obj_struc( obj ) == BLIS_BITVAL_SYMMETRIC );
}
static bool_t bli_obj_is_triangular( obj_t* obj )
{
return ( bli_obj_struc( obj ) == BLIS_BITVAL_TRIANGULAR );
return ( bool_t )
( bli_obj_struc( obj ) == BLIS_BITVAL_TRIANGULAR );
}
// Info modification
static void bli_obj_apply_trans( trans_t trans, obj_t* obj )
{
obj->info = obj->info ^ trans;
obj->info = ( objbits_t )
( obj->info ^ trans );
}
static void bli_obj_apply_conj( conj_t conj, obj_t* obj )
{
obj->info = obj->info ^ conj;
obj->info = ( objbits_t )
( obj->info ^ conj );
}
static void bli_obj_set_conjtrans( trans_t trans, obj_t* obj )
{
obj->info = ( obj->info & ~BLIS_CONJTRANS_BITS ) | trans;
obj->info = ( objbits_t )
( obj->info & ~BLIS_CONJTRANS_BITS ) | trans;
}
static void bli_obj_set_onlytrans( trans_t trans, obj_t* obj )
{
obj->info = ( obj->info & ~BLIS_TRANS_BIT ) | trans;
obj->info = ( objbits_t )
( obj->info & ~BLIS_TRANS_BIT ) | trans;
}
static void bli_obj_set_conj( conj_t conj, obj_t* obj )
{
obj->info = ( obj->info & ~BLIS_CONJ_BIT ) | conj;
obj->info = ( objbits_t )
( obj->info & ~BLIS_CONJ_BIT ) | conj;
}
static void bli_obj_set_uplo( uplo_t uplo, obj_t* obj )
{
obj->info = ( obj->info & ~BLIS_UPLO_BITS ) | uplo;
obj->info = ( objbits_t )
( obj->info & ~BLIS_UPLO_BITS ) | uplo;
}
static void bli_obj_set_diag( diag_t diag, obj_t* obj )
{
obj->info = ( obj->info & ~BLIS_UNIT_DIAG_BIT ) | diag;
obj->info = ( objbits_t )
( obj->info & ~BLIS_UNIT_DIAG_BIT ) | diag;
}
static void bli_obj_set_invert_diag( invdiag_t invdiag, obj_t* obj )
{
obj->info = ( obj->info & ~BLIS_INVERT_DIAG_BIT ) | invdiag;
obj->info = ( objbits_t )
( obj->info & ~BLIS_INVERT_DIAG_BIT ) | invdiag;
}
static void bli_obj_set_dt( num_t dt, obj_t* obj )
{
obj->info = ( obj->info & ~BLIS_DATATYPE_BITS ) | dt;
obj->info = ( objbits_t )
( obj->info & ~BLIS_DATATYPE_BITS ) | dt;
}
static void bli_obj_set_target_dt( num_t dt, obj_t* obj )
{
obj->info = ( obj->info & ~BLIS_TARGET_DT_BITS ) | ( dt << BLIS_TARGET_DT_SHIFT );
obj->info = ( objbits_t )
( obj->info & ~BLIS_TARGET_DT_BITS ) | ( dt << BLIS_TARGET_DT_SHIFT );
}
static void bli_obj_set_target_domain( dom_t dt, obj_t* obj )
{
obj->info = ( obj->info & ~BLIS_TARGET_DOMAIN_BIT ) | ( dt << BLIS_TARGET_DT_SHIFT );
obj->info = ( objbits_t )
( obj->info & ~BLIS_TARGET_DOMAIN_BIT ) | ( dt << BLIS_TARGET_DT_SHIFT );
}
static void bli_obj_set_target_prec( prec_t dt, obj_t* obj )
{
obj->info = ( obj->info & ~BLIS_TARGET_PREC_BIT ) | ( dt << BLIS_TARGET_DT_SHIFT );
obj->info = ( objbits_t )
( obj->info & ~BLIS_TARGET_PREC_BIT ) | ( dt << BLIS_TARGET_DT_SHIFT );
}
static void bli_obj_set_exec_dt( num_t dt, obj_t* obj )
{
obj->info = ( obj->info & ~BLIS_EXEC_DT_BITS ) | ( dt << BLIS_EXEC_DT_SHIFT );
obj->info = ( objbits_t )
( obj->info & ~BLIS_EXEC_DT_BITS ) | ( dt << BLIS_EXEC_DT_SHIFT );
}
static void bli_obj_set_exec_domain( dom_t dt, obj_t* obj )
{
obj->info = ( obj->info & ~BLIS_EXEC_DOMAIN_BIT ) | ( dt << BLIS_EXEC_DT_SHIFT );
obj->info = ( objbits_t )
( obj->info & ~BLIS_EXEC_DOMAIN_BIT ) | ( dt << BLIS_EXEC_DT_SHIFT );
}
static void bli_obj_set_exec_prec( prec_t dt, obj_t* obj )
{
obj->info = ( obj->info & ~BLIS_EXEC_PREC_BIT ) | ( dt << BLIS_EXEC_DT_SHIFT );
obj->info = ( objbits_t )
( obj->info & ~BLIS_EXEC_PREC_BIT ) | ( dt << BLIS_EXEC_DT_SHIFT );
}
static void bli_obj_set_pack_schema( pack_t schema, obj_t* obj )
{
obj->info = ( obj->info & ~BLIS_PACK_SCHEMA_BITS ) | schema;
obj->info = ( objbits_t )
( obj->info & ~BLIS_PACK_SCHEMA_BITS ) | schema;
}
static void bli_obj_set_pack_order_if_upper( packord_t ordif, obj_t* obj )
{
obj->info = ( obj->info & ~BLIS_PACK_REV_IF_UPPER_BIT ) | ordif;
obj->info = ( objbits_t )
( obj->info & ~BLIS_PACK_REV_IF_UPPER_BIT ) | ordif;
}
static void bli_obj_set_pack_order_if_lower( packord_t ordif, obj_t* obj )
{
obj->info = ( obj->info & ~BLIS_PACK_REV_IF_LOWER_BIT ) | ordif;
obj->info = ( objbits_t )
( obj->info & ~BLIS_PACK_REV_IF_LOWER_BIT ) | ordif;
}
// NOTE: The packbuf_t bitfield in the obj_t is currently unused. Instead,
@@ -407,12 +478,14 @@ static void bli_obj_set_pack_order_if_lower( packord_t ordif, obj_t* obj )
// present in the control tree).
static void bli_obj_set_pack_buffer_type( packbuf_t buf_type, obj_t* obj )
{
obj->info = ( obj->info & ~BLIS_PACK_BUFFER_BITS ) | buf_type;
obj->info = ( objbits_t )
( obj->info & ~BLIS_PACK_BUFFER_BITS ) | buf_type;
}
static void bli_obj_set_struc( struc_t struc, obj_t* obj )
{
obj->info = ( obj->info & ~BLIS_STRUC_BITS ) | struc;
obj->info = ( objbits_t )
( obj->info & ~BLIS_STRUC_BITS ) | struc;
}
static void bli_obj_toggle_trans( obj_t* obj )
@@ -427,7 +500,8 @@ static void bli_obj_toggle_conj( obj_t* obj )
static void bli_obj_toggle_uplo( obj_t* obj )
{
obj->info = ( obj->info ^ BLIS_LOWER_BIT ) ^ BLIS_UPPER_BIT;
obj->info = ( objbits_t )
( obj->info ^ BLIS_LOWER_BIT ) ^ BLIS_UPPER_BIT;
}
// Root matrix query
@@ -484,12 +558,14 @@ static void bli_obj_set_as_root( obj_t* obj )
static doff_t bli_obj_diag_offset( obj_t* obj )
{
return ( obj->diag_off );
return ( doff_t )
( obj->diag_off );
}
static doff_t bli_obj_diag_offset_after_trans( obj_t* obj )
{
return ( bli_obj_has_trans( obj ) ? -bli_obj_diag_offset( obj )
return ( doff_t )
( bli_obj_has_trans( obj ) ? -bli_obj_diag_offset( obj )
: bli_obj_diag_offset( obj ) );
}
@@ -553,8 +629,9 @@ static dim_t bli_obj_width_after_trans( obj_t* obj )
static bool_t bli_obj_is_1x1( obj_t* x )
{
return ( bli_obj_length( x ) == 1 &&
bli_obj_width( x ) == 1 );
return ( bool_t )
( bli_obj_length( x ) == 1 &&
bli_obj_width( x ) == 1 );
}
// Stride/increment query
@@ -595,7 +672,8 @@ static inc_t bli_obj_imag_stride_mag( obj_t* obj )
// the diagonal.
static dim_t bli_obj_length_stored( obj_t* obj )
{
return ( bli_obj_is_upper( obj )
return ( dim_t )
( bli_obj_is_upper( obj )
? bli_min( bli_obj_length( obj ),
bli_obj_width( obj ) - bli_obj_diag_offset( obj ) )
: bli_min( bli_obj_length( obj ),
@@ -605,7 +683,8 @@ static dim_t bli_obj_length_stored( obj_t* obj )
static dim_t bli_obj_width_stored( obj_t* obj )
{
return ( bli_obj_is_lower( obj )
return ( dim_t )
( bli_obj_is_lower( obj )
? bli_min( bli_obj_width( obj ),
bli_obj_length( obj ) + bli_obj_diag_offset( obj ) )
: bli_min( bli_obj_width( obj ),
@@ -641,24 +720,28 @@ static inc_t bli_obj_vector_inc( obj_t* x )
static bool_t bli_obj_is_vector( obj_t* x )
{
return ( bli_obj_length( x ) == 1 ||
bli_obj_width( x ) == 1 );
return ( bool_t )
( bli_obj_length( x ) == 1 ||
bli_obj_width( x ) == 1 );
}
static bool_t bli_obj_is_row_vector( obj_t* x )
{
return ( bli_obj_length( x ) == 1 );
return ( bool_t )
( bli_obj_length( x ) == 1 );
}
static bool_t bli_obj_is_col_vector( obj_t* x )
{
return ( bli_obj_width( x ) == 1 );
return ( bool_t )
( bli_obj_width( x ) == 1 );
}
static bool_t bli_obj_has_zero_dim( obj_t* x )
{
return ( bli_obj_length( x ) == 0 ||
bli_obj_width( x ) == 0 );
return ( bool_t )
( bli_obj_length( x ) == 0 ||
bli_obj_width( x ) == 0 );
}
// Dimension modification
@@ -711,28 +794,33 @@ static void bli_obj_set_dims_with_trans( trans_t trans, dim_t m, dim_t n, obj_t*
static bool_t bli_obj_is_row_stored( obj_t* obj )
{
return ( bli_obj_col_stride_mag( obj ) == 1 );
return ( bool_t )
( bli_obj_col_stride_mag( obj ) == 1 );
}
static bool_t bli_obj_is_col_stored( obj_t* obj )
{
return ( bli_obj_row_stride_mag( obj ) == 1 );
return ( bool_t )
( bli_obj_row_stride_mag( obj ) == 1 );
}
static bool_t bli_obj_is_gen_stored( obj_t* obj )
{
return ( bli_obj_row_stride_mag( obj ) != 1 &&
return ( bool_t )
( bli_obj_row_stride_mag( obj ) != 1 &&
bli_obj_col_stride_mag( obj ) != 1 );
}
static bool_t bli_obj_is_row_tilted( obj_t* obj )
{
return ( bli_obj_col_stride_mag( obj ) < bli_obj_row_stride_mag( obj ) );
return ( bool_t )
( bli_obj_col_stride_mag( obj ) < bli_obj_row_stride_mag( obj ) );
}
static bool_t bli_obj_is_col_tilted( obj_t* obj )
{
return ( bli_obj_row_stride_mag( obj ) < bli_obj_col_stride_mag( obj ) );
return ( bool_t )
( bli_obj_row_stride_mag( obj ) < bli_obj_col_stride_mag( obj ) );
}
// Stride/increment modification
@@ -793,29 +881,34 @@ static void bli_obj_inc_offs( dim_t offm, dim_t offn, obj_t* obj )
static bool_t bli_obj_is_strictly_above_diag( obj_t* obj )
{
return ( ( doff_t )bli_obj_length( obj ) <= -bli_obj_diag_offset( obj ) );
return ( bool_t )
( ( doff_t )bli_obj_length( obj ) <= -bli_obj_diag_offset( obj ) );
}
static bool_t bli_obj_is_strictly_below_diag( obj_t* obj )
{
return ( ( doff_t )bli_obj_width( obj ) <= bli_obj_diag_offset( obj ) );
return ( bool_t )
( ( doff_t )bli_obj_width( obj ) <= bli_obj_diag_offset( obj ) );
}
static bool_t bli_obj_is_outside_diag( obj_t* obj )
{
return ( bli_obj_is_strictly_above_diag( obj ) ||
return ( bool_t )
( bli_obj_is_strictly_above_diag( obj ) ||
bli_obj_is_strictly_below_diag( obj ) );
}
static bool_t bli_obj_intersects_diag( obj_t* obj )
{
return ( !bli_obj_is_strictly_above_diag( obj ) &&
return ( bool_t )
( !bli_obj_is_strictly_above_diag( obj ) &&
!bli_obj_is_strictly_below_diag( obj ) );
}
static bool_t bli_obj_is_unstored_subpart( obj_t* obj )
{
return ( ( bli_obj_root_is_lower( obj ) && bli_obj_is_strictly_above_diag( obj ) ) ||
return ( bool_t )
( ( bli_obj_root_is_lower( obj ) && bli_obj_is_strictly_above_diag( obj ) ) ||
( bli_obj_root_is_upper( obj ) && bli_obj_is_strictly_below_diag( obj ) ) );
}
@@ -837,7 +930,8 @@ static void bli_obj_set_buffer( void* p, obj_t* obj )
static void* bli_obj_internal_scalar_buffer( obj_t* obj )
{
return ( &( obj->scalar ) );
return ( void* )
( &( obj->scalar ) );
}
// Bufferless scalar field modification
@@ -1055,7 +1149,8 @@ static void bli_obj_alias_to( obj_t* a, obj_t* b )
static bool_t bli_obj_is_alias_of( obj_t* a, obj_t* b )
{
return ( bli_obj_buffer( a ) == bli_obj_buffer( b ) );
return ( bool_t )
( bli_obj_buffer( a ) == bli_obj_buffer( b ) );
}
@@ -1132,7 +1227,7 @@ static void bli_obj_imag_part( obj_t* c, obj_t* i )
// Update the buffer.
inc_t is_c = bli_obj_imag_stride( c );
char* p = bli_obj_buffer_at_off( c );
char* p = ( char* )bli_obj_buffer_at_off( c );
bli_obj_set_buffer( p + is_c * es_c/2, i );
}
}

View File

@@ -42,17 +42,20 @@
static bool_t bli_is_aligned_to( siz_t p, siz_t size )
{
return ( p % size == 0 );
return ( bool_t )
( p % size == 0 );
}
static bool_t bli_is_unaligned_to( siz_t p, siz_t size )
{
return ( p % size != 0 );
return ( bool_t )
( p % size != 0 );
}
static siz_t bli_offset_past_alignment( siz_t p, siz_t size )
{
return ( siz_t )( p % size );
return ( siz_t )
( p % size );
}
@@ -60,86 +63,102 @@ static siz_t bli_offset_past_alignment( siz_t p, siz_t size )
static bool_t bli_is_float( num_t dt )
{
return ( dt == BLIS_FLOAT );
return ( bool_t )
( dt == BLIS_FLOAT );
}
static bool_t bli_is_double( num_t dt )
{
return ( dt == BLIS_DOUBLE );
return ( bool_t )
( dt == BLIS_DOUBLE );
}
static bool_t bli_is_scomplex( num_t dt )
{
return ( dt == BLIS_SCOMPLEX );
return ( bool_t )
( dt == BLIS_SCOMPLEX );
}
static bool_t bli_is_dcomplex( num_t dt )
{
return ( dt == BLIS_DCOMPLEX );
return ( bool_t )
( dt == BLIS_DCOMPLEX );
}
static bool_t bli_is_constant( num_t dt )
{
return ( dt == BLIS_CONSTANT );
return ( bool_t )
( dt == BLIS_CONSTANT );
}
static bool_t bli_is_int( num_t dt )
{
return ( dt == BLIS_INT );
return ( bool_t )
( dt == BLIS_INT );
}
static bool_t bli_is_real( num_t dt )
{
return ( bli_is_float( dt ) ||
bli_is_double( dt ) );
return ( bool_t )
( bli_is_float( dt ) ||
bli_is_double( dt ) );
}
static bool_t bli_is_complex( num_t dt )
{
return ( bli_is_scomplex( dt ) ||
bli_is_dcomplex( dt ) );
return ( bool_t )
( bli_is_scomplex( dt ) ||
bli_is_dcomplex( dt ) );
}
static bool_t bli_is_single_prec( num_t dt )
{
return ( bli_is_float( dt ) ||
bli_is_scomplex( dt ) );
return ( bool_t )
( bli_is_float( dt ) ||
bli_is_scomplex( dt ) );
}
static bool_t bli_is_double_prec( num_t dt )
{
return ( bli_is_double( dt ) ||
bli_is_dcomplex( dt ) );
return ( bool_t )
( bli_is_double( dt ) ||
bli_is_dcomplex( dt ) );
}
static dom_t bli_dt_domain( num_t dt )
{
return ( dt & BLIS_DOMAIN_BIT );
return ( dom_t )
( dt & BLIS_DOMAIN_BIT );
}
static prec_t bli_dt_prec( num_t dt )
{
return ( dt & BLIS_PRECISION_BIT );
return ( prec_t )
( dt & BLIS_PRECISION_BIT );
}
static num_t bli_dt_proj_to_real( num_t dt )
{
return ( dt & ~BLIS_BITVAL_COMPLEX );
return ( num_t )
( dt & ~BLIS_BITVAL_COMPLEX );
}
static num_t bli_dt_proj_to_complex( num_t dt )
{
return ( dt | BLIS_BITVAL_COMPLEX );
return ( num_t )
( dt | BLIS_BITVAL_COMPLEX );
}
static num_t bli_dt_proj_to_single_prec( num_t dt )
{
return ( dt & ~BLIS_BITVAL_DOUBLE_PREC );
return ( num_t )
( dt & ~BLIS_BITVAL_DOUBLE_PREC );
}
static num_t bli_dt_proj_to_double_prec( num_t dt )
{
return ( dt | BLIS_BITVAL_DOUBLE_PREC );
return ( num_t )
( dt | BLIS_BITVAL_DOUBLE_PREC );
}
@@ -147,62 +166,74 @@ static num_t bli_dt_proj_to_double_prec( num_t dt )
static bool_t bli_is_notrans( trans_t trans )
{
return ( trans == BLIS_NO_TRANSPOSE );
return ( bool_t )
( trans == BLIS_NO_TRANSPOSE );
}
static bool_t bli_is_trans( trans_t trans )
{
return ( trans == BLIS_TRANSPOSE );
return ( bool_t )
( trans == BLIS_TRANSPOSE );
}
static bool_t bli_is_conjnotrans( trans_t trans )
{
return ( trans == BLIS_CONJ_NO_TRANSPOSE );
return ( bool_t )
( trans == BLIS_CONJ_NO_TRANSPOSE );
}
static bool_t bli_is_conjtrans( trans_t trans )
{
return ( trans == BLIS_CONJ_TRANSPOSE );
return ( bool_t )
( trans == BLIS_CONJ_TRANSPOSE );
}
static bool_t bli_does_notrans( trans_t trans )
{
return ( (~trans & BLIS_TRANS_BIT ) == BLIS_BITVAL_TRANS );
return ( bool_t )
( (~trans & BLIS_TRANS_BIT ) == BLIS_BITVAL_TRANS );
}
static bool_t bli_does_trans( trans_t trans )
{
return ( ( trans & BLIS_TRANS_BIT ) == BLIS_BITVAL_TRANS );
return ( bool_t )
( ( trans & BLIS_TRANS_BIT ) == BLIS_BITVAL_TRANS );
}
static bool_t bli_does_noconj( trans_t trans )
{
return ( (~trans & BLIS_CONJ_BIT ) == BLIS_BITVAL_CONJ );
return ( bool_t )
( (~trans & BLIS_CONJ_BIT ) == BLIS_BITVAL_CONJ );
}
static bool_t bli_does_conj( trans_t trans )
{
return ( ( trans & BLIS_CONJ_BIT ) == BLIS_BITVAL_CONJ );
return ( bool_t )
( ( trans & BLIS_CONJ_BIT ) == BLIS_BITVAL_CONJ );
}
static trans_t bli_extract_trans( trans_t trans )
{
return ( trans & BLIS_TRANS_BIT );
return ( trans_t )
( trans & BLIS_TRANS_BIT );
}
static conj_t bli_extract_conj( trans_t trans )
{
return ( trans & BLIS_CONJ_BIT );
return ( conj_t )
( trans & BLIS_CONJ_BIT );
}
static trans_t bli_trans_toggled( trans_t trans )
{
return ( trans ^ BLIS_TRANS_BIT );
return ( trans_t )
( trans ^ BLIS_TRANS_BIT );
}
static trans_t bli_trans_toggled_conj( trans_t trans )
{
return ( trans ^ BLIS_CONJ_BIT );
return ( trans_t )
( trans ^ BLIS_CONJ_BIT );
}
static void bli_toggle_trans( trans_t* trans )
@@ -215,12 +246,14 @@ static void bli_toggle_trans( trans_t* trans )
static bool_t bli_is_left( side_t side )
{
return ( side == BLIS_LEFT );
return ( bool_t )
( side == BLIS_LEFT );
}
static bool_t bli_is_right( side_t side )
{
return ( side == BLIS_RIGHT );
return ( bool_t )
( side == BLIS_RIGHT );
}
static side_t bli_side_toggled( side_t side )
@@ -238,33 +271,39 @@ static void bli_toggle_side( side_t* side )
static bool_t bli_is_lower( uplo_t uplo )
{
return ( uplo == BLIS_LOWER );
return ( bool_t )
( uplo == BLIS_LOWER );
}
static bool_t bli_is_upper( uplo_t uplo )
{
return ( uplo == BLIS_UPPER );
return ( bool_t )
( uplo == BLIS_UPPER );
}
static bool_t bli_is_upper_or_lower( uplo_t uplo )
{
return ( bli_is_upper( uplo ) ||
bli_is_lower( uplo ) );
return ( bool_t )
( bli_is_upper( uplo ) ||
bli_is_lower( uplo ) );
}
static bool_t bli_is_dense( uplo_t uplo )
{
return ( uplo == BLIS_DENSE );
return ( bool_t )
( uplo == BLIS_DENSE );
}
static bool_t bli_is_zeros( uplo_t uplo )
{
return ( uplo == BLIS_ZEROS );
return ( bool_t )
( uplo == BLIS_ZEROS );
}
static uplo_t bli_uplo_toggled( uplo_t uplo )
{
return ( bli_is_upper_or_lower( uplo ) ?
return ( uplo_t )
( bli_is_upper_or_lower( uplo ) ?
( ( uplo ^ BLIS_LOWER_BIT ) ^ BLIS_UPPER_BIT ) : uplo
);
}
@@ -279,28 +318,33 @@ static void bli_toggle_uplo( uplo_t* uplo )
static bool_t bli_is_general( struc_t struc )
{
return ( struc == BLIS_GENERAL );
return ( bool_t )
( struc == BLIS_GENERAL );
}
static bool_t bli_is_hermitian( struc_t struc )
{
return ( struc == BLIS_HERMITIAN );
return ( bool_t )
( struc == BLIS_HERMITIAN );
}
static bool_t bli_is_symmetric( struc_t struc )
{
return ( struc == BLIS_SYMMETRIC );
return ( bool_t )
( struc == BLIS_SYMMETRIC );
}
static bool_t bli_is_triangular( struc_t struc )
{
return ( struc == BLIS_TRIANGULAR );
return ( bool_t )
( struc == BLIS_TRIANGULAR );
}
static bool_t bli_is_herm_or_symm( struc_t struc )
{
return ( bli_is_hermitian( struc ) ||
bli_is_symmetric( struc ) );
return ( bool_t )
( bli_is_hermitian( struc ) ||
bli_is_symmetric( struc ) );
}
@@ -308,22 +352,26 @@ static bool_t bli_is_herm_or_symm( struc_t struc )
static bool_t bli_is_noconj( conj_t conj )
{
return ( conj == BLIS_NO_CONJUGATE );
return ( bool_t )
( conj == BLIS_NO_CONJUGATE );
}
static bool_t bli_is_conj( conj_t conj )
{
return ( conj == BLIS_CONJUGATE );
return ( bool_t )
( conj == BLIS_CONJUGATE );
}
static conj_t bli_conj_toggled( conj_t conj )
{
return ( conj ^ BLIS_CONJ_BIT );
return ( conj_t )
( conj ^ BLIS_CONJ_BIT );
}
static conj_t bli_apply_conj( conj_t conjapp, conj_t conj )
{
return ( conj ^ conjapp );
return ( conj_t )
( conj ^ conjapp );
}
static void bli_toggle_conj( conj_t* conj )
@@ -336,12 +384,14 @@ static void bli_toggle_conj( conj_t* conj )
static bool_t bli_is_nonunit_diag( diag_t diag )
{
return ( diag == BLIS_NONUNIT_DIAG );
return ( bool_t )
( diag == BLIS_NONUNIT_DIAG );
}
static bool_t bli_is_unit_diag( diag_t diag )
{
return ( diag == BLIS_UNIT_DIAG );
return ( bool_t )
( diag == BLIS_UNIT_DIAG );
}
@@ -349,42 +399,50 @@ static bool_t bli_is_unit_diag( diag_t diag )
static bool_t bli_zero_dim1( dim_t m )
{
return ( m == 0 );
return ( bool_t )
( m == 0 );
}
static bool_t bli_zero_dim2( dim_t m, dim_t n )
{
return ( m == 0 || n == 0 );
return ( bool_t )
( m == 0 || n == 0 );
}
static bool_t bli_zero_dim3( dim_t m, dim_t n, dim_t k )
{
return ( m == 0 || n == 0 || k == 0 );
return ( bool_t )
( m == 0 || n == 0 || k == 0 );
}
static bool_t bli_nonzero_dim( dim_t m )
{
return ( m > 0 );
return ( bool_t )
( m > 0 );
}
static bool_t bli_vector_dim( dim_t m, dim_t n )
{
return ( m == 1 ? n : m );
return ( bool_t )
( m == 1 ? n : m );
}
static bool_t bli_is_vector( dim_t m, dim_t n )
{
return ( m == 1 || n == 1 );
return ( bool_t )
( m == 1 || n == 1 );
}
static bool_t bli_is_row_vector( dim_t m, dim_t n )
{
return ( m == 1 );
return ( bool_t )
( m == 1 );
}
static bool_t bli_is_col_vector( dim_t m, dim_t n )
{
return ( n == 1 );
return ( bool_t )
( n == 1 );
}
static void bli_set_dim_with_side( side_t side, dim_t m, dim_t n, dim_t* dim )
@@ -412,13 +470,15 @@ static void bli_set_dims_incs_with_trans( trans_t trans,
static dim_t bli_determine_blocksize_dim_f( dim_t i, dim_t dim, dim_t b_alg )
{
return ( bli_min( b_alg, dim - i ) );
return ( dim_t )
( bli_min( b_alg, dim - i ) );
}
static dim_t bli_determine_blocksize_dim_b( dim_t i, dim_t dim, dim_t b_alg )
{
return ( i == 0 && dim % b_alg != 0 ? dim % b_alg
: b_alg );
return ( dim_t )
( i == 0 && dim % b_alg != 0 ? dim % b_alg
: b_alg );
}
@@ -426,63 +486,74 @@ static dim_t bli_determine_blocksize_dim_b( dim_t i, dim_t dim, dim_t b_alg )
static inc_t bli_vector_inc( trans_t trans, dim_t m, dim_t n, inc_t rs, inc_t cs )
{
return ( bli_does_notrans( trans ) ? ( m == 1 ? cs : rs )
return ( inc_t )
( bli_does_notrans( trans ) ? ( m == 1 ? cs : rs )
: ( m == 1 ? rs : cs ) );
}
static bool_t bli_is_row_stored( inc_t rs, inc_t cs )
{
return ( bli_abs( cs ) == 1 );
return ( bool_t )
( bli_abs( cs ) == 1 );
}
static bool_t bli_is_col_stored( inc_t rs, inc_t cs )
{
return ( bli_abs( rs ) == 1 );
return ( bool_t )
( bli_abs( rs ) == 1 );
}
static bool_t bli_is_row_stored_f( dim_t m, dim_t n, inc_t rs, inc_t cs )
{
return ( cs == 1 && ( rs > 1 || n == 1 ) );
return ( bool_t )
( cs == 1 && ( rs > 1 || n == 1 ) );
}
static bool_t bli_is_col_stored_f( dim_t m, dim_t n, inc_t rs, inc_t cs )
{
return ( rs == 1 && ( cs > 1 || m == 1 ) );
return ( bool_t )
( rs == 1 && ( cs > 1 || m == 1 ) );
}
static bool_t bli_is_gen_stored( inc_t rs, inc_t cs )
{
return ( bli_abs( rs ) != 1 &&
bli_abs( cs ) != 1 );
return ( bool_t )
( bli_abs( rs ) != 1 &&
bli_abs( cs ) != 1 );
}
static bool_t bli_is_row_tilted( dim_t m, dim_t n, inc_t rs, inc_t cs )
{
return ( bli_abs( cs ) == bli_abs( rs )
? n < m
: bli_abs( cs ) < bli_abs( rs ) );
return ( bool_t )
( bli_abs( cs ) == bli_abs( rs )
? n < m
: bli_abs( cs ) < bli_abs( rs ) );
}
static bool_t bli_is_col_tilted( dim_t m, dim_t n, inc_t rs, inc_t cs )
{
return ( bli_abs( rs ) == bli_abs( cs )
? m < n
: bli_abs( rs ) < bli_abs( cs ) );
return ( bool_t )
( bli_abs( rs ) == bli_abs( cs )
? m < n
: bli_abs( rs ) < bli_abs( cs ) );
}
static bool_t bli_has_nonunit_inc1( inc_t s1 )
{
return ( s1 != 1 );
return ( bool_t )
( s1 != 1 );
}
static bool_t bli_has_nonunit_inc2( inc_t s1, inc_t s2 )
{
return ( s1 != 1 || s2 != 1 );
return ( bool_t )
( s1 != 1 || s2 != 1 );
}
static bool_t bli_has_nonunit_inc3( inc_t s1, inc_t s2, inc_t s3 )
{
return ( s1 != 1 || s2 != 1 || s3 != 1 );
return ( bool_t )
( s1 != 1 || s2 != 1 || s3 != 1 );
}
@@ -507,69 +578,76 @@ static void bli_shift_diag_offset_to_shrink_uplo( uplo_t uplo, doff_t* diagoff )
static bool_t bli_diag_offset_with_trans( trans_t trans, doff_t diagoff )
{
return ( bli_does_trans( trans ) ? -diagoff : diagoff );
return ( bool_t )
( bli_does_trans( trans ) ? -diagoff : diagoff );
}
static bool_t bli_is_strictly_above_diag( doff_t diagoff, trans_t trans, dim_t m, dim_t n )
{
return ( bli_does_trans( trans )
? ( ( doff_t )n <= -diagoff )
: ( ( doff_t )m <= -diagoff ) );
return ( bool_t )
( bli_does_trans( trans )
? ( ( doff_t )n <= -diagoff )
: ( ( doff_t )m <= -diagoff ) );
}
static bool_t bli_is_strictly_below_diag( doff_t diagoff, trans_t trans, dim_t m, dim_t n )
{
return ( bli_does_trans( trans )
? ( ( doff_t )m <= diagoff )
: ( ( doff_t )n <= diagoff ) );
return ( bool_t )
( bli_does_trans( trans )
? ( ( doff_t )m <= diagoff )
: ( ( doff_t )n <= diagoff ) );
}
static bool_t bli_is_outside_diag( doff_t diagoff, trans_t trans, dim_t m, dim_t n )
{
return ( bli_is_strictly_above_diag( diagoff, trans, m, n ) ||
return ( bool_t )
( bli_is_strictly_above_diag( diagoff, trans, m, n ) ||
bli_is_strictly_below_diag( diagoff, trans, m, n ) );
}
static bool_t bli_is_stored_subpart( doff_t diagoff, trans_t trans, uplo_t uplo, dim_t m, dim_t n )
{
return
return ( bool_t )
( ( bli_is_upper( uplo ) && bli_is_strictly_above_diag( diagoff, trans, m, n ) ) ||
( bli_is_lower( uplo ) && bli_is_strictly_below_diag( diagoff, trans, m, n ) ) );
}
static bool_t bli_is_unstored_subpart( doff_t diagoff, trans_t trans, uplo_t uplo, dim_t m, dim_t n )
{
return
return ( bool_t )
( ( bli_is_upper( uplo ) && bli_is_strictly_below_diag( diagoff, trans, m, n ) ) ||
( bli_is_lower( uplo ) && bli_is_strictly_above_diag( diagoff, trans, m, n ) ) );
}
static bool_t bli_is_strictly_above_diag_n( doff_t diagoff, dim_t m, dim_t n )
{
return ( ( doff_t )m <= -diagoff );
return ( bool_t )
( ( doff_t )m <= -diagoff );
}
static bool_t bli_is_strictly_below_diag_n( doff_t diagoff, dim_t m, dim_t n )
{
return ( ( doff_t )n <= diagoff );
return ( bool_t )
( ( doff_t )n <= diagoff );
}
static bool_t bli_intersects_diag_n( doff_t diagoff, dim_t m, dim_t n )
{
return ( !bli_is_strictly_above_diag_n( diagoff, m, n ) &&
return ( bool_t )
( !bli_is_strictly_above_diag_n( diagoff, m, n ) &&
!bli_is_strictly_below_diag_n( diagoff, m, n ) );
}
static bool_t bli_is_stored_subpart_n( doff_t diagoff, uplo_t uplo, dim_t m, dim_t n )
{
return
return ( bool_t )
( ( bli_is_upper( uplo ) && bli_is_strictly_above_diag_n( diagoff, m, n ) ) ||
( bli_is_lower( uplo ) && bli_is_strictly_below_diag_n( diagoff, m, n ) ) );
}
static bool_t bli_is_unstored_subpart_n( doff_t diagoff, uplo_t uplo, dim_t m, dim_t n )
{
return
return ( bool_t )
( ( bli_is_upper( uplo ) && bli_is_strictly_below_diag_n( diagoff, m, n ) ) ||
( bli_is_lower( uplo ) && bli_is_strictly_above_diag_n( diagoff, m, n ) ) );
}
@@ -658,12 +736,14 @@ static void bli_reverse_index_direction( dim_t n, dim_t* start, dim_t* end )
static bool_t bli_is_m_dim( mdim_t mdim )
{
return ( mdim == BLIS_M );
return ( bool_t )
( mdim == BLIS_M );
}
static bool_t bli_is_n_dim( mdim_t mdim )
{
return ( mdim == BLIS_N );
return ( bool_t )
( mdim == BLIS_N );
}
static mdim_t bli_dim_toggled( mdim_t mdim )
@@ -682,27 +762,32 @@ static void bli_toggle_dim( mdim_t* mdim )
static bool_t bli_is_edge_f( dim_t i, dim_t n_iter, dim_t n_left )
{
return ( i == n_iter - 1 && n_left != 0 );
return ( bool_t )
( i == n_iter - 1 && n_left != 0 );
}
static bool_t bli_is_not_edge_f( dim_t i, dim_t n_iter, dim_t n_left )
{
return ( i != n_iter - 1 || n_left == 0 );
return ( bool_t )
( i != n_iter - 1 || n_left == 0 );
}
static bool_t bli_is_edge_b( dim_t i, dim_t n_iter, dim_t n_left )
{
return ( i == 0 && n_left != 0 );
return ( bool_t )
( i == 0 && n_left != 0 );
}
static bool_t bli_is_not_edge_b( dim_t i, dim_t n_iter, dim_t n_left )
{
return ( i != 0 || n_left == 0 );
return ( bool_t )
( i != 0 || n_left == 0 );
}
static bool_t bli_is_last_iter( dim_t i, dim_t n_iter, dim_t tid, dim_t nth )
{
return ( i == n_iter - 1 - ( ( n_iter - tid - 1 ) % nth ) );
return ( bool_t )
( i == n_iter - 1 - ( ( n_iter - tid - 1 ) % nth ) );
}
@@ -710,99 +795,117 @@ static bool_t bli_is_last_iter( dim_t i, dim_t n_iter, dim_t tid, dim_t nth )
static guint_t bli_packbuf_index( packbuf_t buf_type )
{
return ( ( buf_type & BLIS_PACK_BUFFER_BITS ) >> BLIS_PACK_BUFFER_SHIFT );
return ( guint_t )
( ( buf_type & BLIS_PACK_BUFFER_BITS ) >> BLIS_PACK_BUFFER_SHIFT );
}
// pack_t-related
static bool_t bli_is_packed( pack_t schema )
{
return ( schema & BLIS_PACK_BIT );
return ( bool_t )
( schema & BLIS_PACK_BIT );
}
static bool_t bli_is_row_packed( pack_t schema )
{
return ( schema & BLIS_PACK_RC_BIT ) == ( BLIS_BITVAL_PACKED_UNSPEC ^
return ( bool_t )
( schema & BLIS_PACK_RC_BIT ) == ( BLIS_BITVAL_PACKED_UNSPEC ^
BLIS_BITVAL_PACKED_ROWS );
}
static bool_t bli_is_col_packed( pack_t schema )
{
return ( schema & BLIS_PACK_RC_BIT ) == ( BLIS_BITVAL_PACKED_UNSPEC ^
return ( bool_t )
( schema & BLIS_PACK_RC_BIT ) == ( BLIS_BITVAL_PACKED_UNSPEC ^
BLIS_BITVAL_PACKED_COLUMNS );
}
static bool_t bli_is_panel_packed( pack_t schema )
{
return ( schema & BLIS_PACK_PANEL_BIT );
return ( bool_t )
( schema & BLIS_PACK_PANEL_BIT );
}
static bool_t bli_is_4mi_packed( pack_t schema )
{
return ( schema & BLIS_PACK_FORMAT_BITS ) == BLIS_BITVAL_4MI;
return ( bool_t )
( schema & BLIS_PACK_FORMAT_BITS ) == BLIS_BITVAL_4MI;
}
static bool_t bli_is_3mi_packed( pack_t schema )
{
return ( schema & BLIS_PACK_FORMAT_BITS ) == BLIS_BITVAL_3MI;
return ( bool_t )
( schema & BLIS_PACK_FORMAT_BITS ) == BLIS_BITVAL_3MI;
}
static bool_t bli_is_3ms_packed( pack_t schema )
{
return ( schema & BLIS_PACK_FORMAT_BITS ) == BLIS_BITVAL_3MS;
return ( bool_t )
( schema & BLIS_PACK_FORMAT_BITS ) == BLIS_BITVAL_3MS;
}
static bool_t bli_is_ro_packed( pack_t schema )
{
return ( schema & BLIS_PACK_FORMAT_BITS ) == BLIS_BITVAL_RO;
return ( bool_t )
( schema & BLIS_PACK_FORMAT_BITS ) == BLIS_BITVAL_RO;
}
static bool_t bli_is_io_packed( pack_t schema )
{
return ( schema & BLIS_PACK_FORMAT_BITS ) == BLIS_BITVAL_IO;
return ( bool_t )
( schema & BLIS_PACK_FORMAT_BITS ) == BLIS_BITVAL_IO;
}
static bool_t bli_is_rpi_packed( pack_t schema )
{
return ( schema & BLIS_PACK_FORMAT_BITS ) == BLIS_BITVAL_RPI;
return ( bool_t )
( schema & BLIS_PACK_FORMAT_BITS ) == BLIS_BITVAL_RPI;
}
static bool_t bli_is_rih_packed( pack_t schema )
{
return ( bli_is_ro_packed( schema ) ||
return ( bool_t )
( bli_is_ro_packed( schema ) ||
bli_is_io_packed( schema ) ||
bli_is_rpi_packed( schema ) );
}
static bool_t bli_is_1r_packed( pack_t schema )
{
return ( schema & BLIS_PACK_FORMAT_BITS ) == BLIS_BITVAL_1R;
return ( bool_t )
( schema & BLIS_PACK_FORMAT_BITS ) == BLIS_BITVAL_1R;
}
static bool_t bli_is_1e_packed( pack_t schema )
{
return ( schema & BLIS_PACK_FORMAT_BITS ) == BLIS_BITVAL_1E;
return ( bool_t )
( schema & BLIS_PACK_FORMAT_BITS ) == BLIS_BITVAL_1E;
}
static bool_t bli_is_1m_packed( pack_t schema )
{
return ( bli_is_1r_packed( schema ) ||
return ( bool_t )
( bli_is_1r_packed( schema ) ||
bli_is_1e_packed( schema ) );
}
static bool_t bli_is_nat_packed( pack_t schema )
{
return ( schema & BLIS_PACK_FORMAT_BITS ) == 0;
return ( bool_t )
( schema & BLIS_PACK_FORMAT_BITS ) == 0;
}
static bool_t bli_is_ind_packed( pack_t schema )
{
return ( schema & BLIS_PACK_FORMAT_BITS ) != 0;
return ( bool_t )
( schema & BLIS_PACK_FORMAT_BITS ) != 0;
}
static guint_t bli_pack_schema_index( pack_t schema )
{
return ( schema & BLIS_PACK_FORMAT_BITS ) >> BLIS_PACK_FORMAT_SHIFT;
return ( guint_t )
( schema & BLIS_PACK_FORMAT_BITS ) >> BLIS_PACK_FORMAT_SHIFT;
}
@@ -814,17 +917,20 @@ static guint_t bli_pack_schema_index( pack_t schema )
// where p0 is a pointer to a datatype of size sizeof_p0.
static void* bli_ptr_inc_by_frac( void* p0, siz_t sizeof_p0, dim_t num, dim_t den )
{
return ( char* )p0 + ( ( num * sizeof_p0 ) / den );
return ( void* )
( ( char* )p0 + ( ( num * ( dim_t )sizeof_p0 ) / den ) );
}
static bool_t bli_is_null( void* p )
{
return ( p == NULL );
return ( bool_t )
( p == NULL );
}
static bool_t bli_is_nonnull( void* p )
{
return ( p != NULL );
return ( bool_t )
( p != NULL );
}