@ -1568,51 +1568,50 @@ static inline int DataTypeFormatString(char* buf, int buf_size, ImGuiDataType da
return 0 ;
}
// FIXME: Adding support for clamping on boundaries of the data type would be nice.
static void DataTypeApplyOp ( ImGuiDataType data_type , int op , void * output , void * arg1 , const void * arg2 )
{
IM_ASSERT ( op = = ' + ' | | op = = ' - ' ) ;
switch ( data_type )
{
case ImGuiDataType_S8 :
if ( op = = ' + ' ) * ( ImS8 * ) output = * ( const ImS8 * ) arg1 + * ( const ImS8 * ) arg2 ;
else if ( op = = ' - ' ) * ( ImS8 * ) output = * ( const ImS8 * ) arg1 - * ( const ImS8 * ) arg2 ;
if ( op = = ' + ' ) { * ( ImS8 * ) output = ImAddClampOverflow ( * ( const ImS8 * ) arg1 , * ( const ImS8 * ) arg2 , IM_S8_MIN , IM_S8_MAX ) ; }
if ( op = = ' - ' ) { * ( ImS8 * ) output = ImSubClampOverflow ( * ( const ImS8 * ) arg1 , * ( const ImS8 * ) arg2 , IM_S8_MIN , IM_S8_MAX ) ; }
return ;
case ImGuiDataType_U8 :
if ( op = = ' + ' ) * ( ImU8 * ) output = * ( const ImU8 * ) arg1 + * ( const ImU8 * ) arg2 ;
else if ( op = = ' - ' ) * ( ImU8 * ) output = * ( const ImU8 * ) arg1 - * ( const ImU8 * ) arg2 ;
if ( op = = ' + ' ) { * ( ImU8 * ) output = ImAddClampOverflow ( * ( const ImU8 * ) arg1 , * ( const ImU8 * ) arg2 , IM_U8_MIN , IM_U8_MAX ) ; }
if ( op = = ' - ' ) { * ( ImU8 * ) output = ImSubClampOverflow ( * ( const ImU8 * ) arg1 , * ( const ImU8 * ) arg2 , IM_U8_MIN , IM_U8_MAX ) ; }
return ;
case ImGuiDataType_S16 :
if ( op = = ' + ' ) * ( ImS16 * ) output = * ( const ImS16 * ) arg1 + * ( const ImS16 * ) arg2 ;
else if ( op = = ' - ' ) * ( ImS16 * ) output = * ( const ImS16 * ) arg1 - * ( const ImS16 * ) arg2 ;
if ( op = = ' + ' ) { * ( ImS16 * ) output = ImAddClampOverflow ( * ( const ImS16 * ) arg1 , * ( const ImS16 * ) arg2 , IM_S16_MIN , IM_S16_MAX ) ; }
if ( op = = ' - ' ) { * ( ImS16 * ) output = ImSubClampOverflow ( * ( const ImS16 * ) arg1 , * ( const ImS16 * ) arg2 , IM_S16_MIN , IM_S16_MAX ) ; }
return ;
case ImGuiDataType_U16 :
if ( op = = ' + ' ) * ( ImU16 * ) output = * ( const ImU16 * ) arg1 + * ( const ImU16 * ) arg2 ;
else if ( op = = ' - ' ) * ( ImU16 * ) output = * ( const ImU16 * ) arg1 - * ( const ImU16 * ) arg2 ;
if ( op = = ' + ' ) { * ( ImU16 * ) output = ImAddClampOverflow ( * ( const ImU16 * ) arg1 , * ( const ImU16 * ) arg2 , IM_U16_MIN , IM_U16_MAX ) ; }
if ( op = = ' - ' ) { * ( ImU16 * ) output = ImSubClampOverflow ( * ( const ImU16 * ) arg1 , * ( const ImU16 * ) arg2 , IM_U16_MIN , IM_U16_MAX ) ; }
return ;
case ImGuiDataType_S32 :
if ( op = = ' + ' ) * ( ImS32 * ) output = * ( const ImS32 * ) arg1 + * ( const ImS32 * ) arg2 ;
else if ( op = = ' - ' ) * ( ImS32 * ) output = * ( const ImS32 * ) arg1 - * ( const ImS32 * ) arg2 ;
if ( op = = ' + ' ) { * ( ImS32 * ) output = ImAddClampOverflow ( * ( const ImS32 * ) arg1 , * ( const ImS32 * ) arg2 , IM_S32_MIN , IM_S32_MAX ) ; }
if ( op = = ' - ' ) { * ( ImS32 * ) output = ImSubClampOverflow ( * ( const ImS32 * ) arg1 , * ( const ImS32 * ) arg2 , IM_S32_MIN , IM_S32_MAX ) ; }
return ;
case ImGuiDataType_U32 :
if ( op = = ' + ' ) * ( ImU32 * ) output = * ( const ImU32 * ) arg1 + * ( const ImU32 * ) arg2 ;
else if ( op = = ' - ' ) * ( ImU32 * ) output = * ( const ImU32 * ) arg1 - * ( const ImU32 * ) arg2 ;
if ( op = = ' + ' ) { * ( ImU32 * ) output = ImAddClampOverflow ( * ( const ImU32 * ) arg1 , * ( const ImU32 * ) arg2 , IM_U32_MIN , IM_U32_MAX ) ; }
if ( op = = ' - ' ) { * ( ImU32 * ) output = ImSubClampOverflow ( * ( const ImU32 * ) arg1 , * ( const ImU32 * ) arg2 , IM_U32_MIN , IM_U32_MAX ) ; }
return ;
case ImGuiDataType_S64 :
if ( op = = ' + ' ) * ( ImS64 * ) output = * ( const ImS64 * ) arg1 + * ( const ImS64 * ) arg2 ;
else if ( op = = ' - ' ) * ( ImS64 * ) output = * ( const ImS64 * ) arg1 - * ( const ImS64 * ) arg2 ;
if ( op = = ' + ' ) { * ( ImS64 * ) output = ImAddClampOverflow ( * ( const ImS64 * ) arg1 , * ( const ImS64 * ) arg2 , IM_S64_MIN , IM_S64_MAX ) ; }
if ( op = = ' - ' ) { * ( ImS64 * ) output = ImSubClampOverflow ( * ( const ImS64 * ) arg1 , * ( const ImS64 * ) arg2 , IM_S64_MIN , IM_S64_MAX ) ; }
return ;
case ImGuiDataType_U64 :
if ( op = = ' + ' ) * ( ImU64 * ) output = * ( const ImU64 * ) arg1 + * ( const ImU64 * ) arg2 ;
else if ( op = = ' - ' ) * ( ImU64 * ) output = * ( const ImU64 * ) arg1 - * ( const ImU64 * ) arg2 ;
if ( op = = ' + ' ) { * ( ImU64 * ) output = ImAddClampOverflow ( * ( const ImU64 * ) arg1 , * ( const ImU64 * ) arg2 , IM_U64_MIN , IM_U64_MAX ) ; }
if ( op = = ' - ' ) { * ( ImU64 * ) output = ImSubClampOverflow ( * ( const ImU64 * ) arg1 , * ( const ImU64 * ) arg2 , IM_U64_MIN , IM_U64_MAX ) ; }
return ;
case ImGuiDataType_Float :
if ( op = = ' + ' ) * ( float * ) output = * ( const float * ) arg1 + * ( const float * ) arg2 ;
else if ( op = = ' - ' ) * ( float * ) output = * ( const float * ) arg1 - * ( const float * ) arg2 ;
if ( op = = ' + ' ) { * ( float * ) output = * ( const float * ) arg1 + * ( const float * ) arg2 ; }
if ( op = = ' - ' ) { * ( float * ) output = * ( const float * ) arg1 - * ( const float * ) arg2 ; }
return ;
case ImGuiDataType_Double :
if ( op = = ' + ' ) * ( double * ) output = * ( const double * ) arg1 + * ( const double * ) arg2 ;
else if ( op = = ' - ' ) * ( double * ) output = * ( const double * ) arg1 - * ( const double * ) arg2 ;
if ( op = = ' + ' ) { * ( double * ) output = * ( const double * ) arg1 + * ( const double * ) arg2 ; }
if ( op = = ' - ' ) { * ( double * ) output = * ( const double * ) arg1 - * ( const double * ) arg2 ; }
return ;
case ImGuiDataType_COUNT : break ;
}