Skip to content

Commit

Permalink
half: add half support.
Browse files Browse the repository at this point in the history
  • Loading branch information
cayrols committed Sep 27, 2023
1 parent e9a9b3b commit 62d59ea
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion testsweeper.hh
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ void throw_error( const char* format, ... );
// -----------------------------------------------------------------------------
enum class DataType {
Integer = 'i',
Half = 'h',
Single = 's',
Double = 'd',
SingleComplex = 'c',
Expand All @@ -68,7 +69,7 @@ enum class DataType {
inline DataType char2datatype( char ch )
{
ch = tolower( ch );
if (ch != 'i' && ch != 's' && ch != 'd' && ch != 'c' && ch != 'z') {
if (ch != 'i' && ch != 'h' && ch != 's' && ch != 'd' && ch != 'c' && ch != 'z') {
throw_error( "invalid value '%c'", ch );
}
return DataType( ch );
Expand All @@ -94,6 +95,9 @@ inline DataType str2datatype( const char* str )
|| str_ == "i32"
|| str_ == "int"
|| str_ == "integer" ) return DataType::Integer;
else if (str_ == "h"
|| str_ == "r16"
|| str_ == "half" ) return DataType::Half;
else if (str_ == "s"
|| str_ == "r32"
|| str_ == "float"
Expand Down Expand Up @@ -121,6 +125,7 @@ inline const char* datatype2str( DataType en )
{
switch (en) {
case DataType::Integer: return "i";
case DataType::Half: return "h";
case DataType::Single: return "s";
case DataType::Double: return "d";
case DataType::SingleComplex: return "c";
Expand Down

0 comments on commit 62d59ea

Please sign in to comment.