/// @file xed-operand-type-enum.c

// This file was automatically generated.
// Do not edit this file.

#include <string.h>
#include <assert.h>
#include "xed-operand-type-enum.h"

typedef struct {
    const char* name;
    xed_operand_type_enum_t value;
} name_table_xed_operand_type_enum_t;
static const name_table_xed_operand_type_enum_t name_array_xed_operand_type_enum_t[] = {
{"INVALID", XED_OPERAND_TYPE_INVALID},
{"ERROR", XED_OPERAND_TYPE_ERROR},
{"IMM", XED_OPERAND_TYPE_IMM},
{"IMM_CONST", XED_OPERAND_TYPE_IMM_CONST},
{"NT_LOOKUP_FN", XED_OPERAND_TYPE_NT_LOOKUP_FN},
{"NT_LOOKUP_FN2", XED_OPERAND_TYPE_NT_LOOKUP_FN2},
{"NT_LOOKUP_FN4", XED_OPERAND_TYPE_NT_LOOKUP_FN4},
{"REG", XED_OPERAND_TYPE_REG},
{"LAST", XED_OPERAND_TYPE_LAST},
{0, XED_OPERAND_TYPE_LAST},
};

        
xed_operand_type_enum_t str2xed_operand_type_enum_t(const char* s)
{
   const name_table_xed_operand_type_enum_t* p = name_array_xed_operand_type_enum_t;
   while( p->name ) {
     if (strcmp(p->name,s) == 0) {
      return p->value;
     }
     p++;
   }
        

   return XED_OPERAND_TYPE_INVALID;
}


const char* xed_operand_type_enum_t2str(const xed_operand_type_enum_t p)
{
   xed_operand_type_enum_t type_idx = p;
   if ( p > XED_OPERAND_TYPE_LAST) type_idx = XED_OPERAND_TYPE_LAST;
   return name_array_xed_operand_type_enum_t[type_idx].name;
}

xed_operand_type_enum_t xed_operand_type_enum_t_last(void) {
    return XED_OPERAND_TYPE_LAST;
}
       
/*

Here is a skeleton switch statement embedded in a comment


  switch(p) {
  case XED_OPERAND_TYPE_INVALID:
  case XED_OPERAND_TYPE_ERROR:
  case XED_OPERAND_TYPE_IMM:
  case XED_OPERAND_TYPE_IMM_CONST:
  case XED_OPERAND_TYPE_NT_LOOKUP_FN:
  case XED_OPERAND_TYPE_NT_LOOKUP_FN2:
  case XED_OPERAND_TYPE_NT_LOOKUP_FN4:
  case XED_OPERAND_TYPE_REG:
  case XED_OPERAND_TYPE_LAST:
  default:
     xed_assert(0);
  }
*/
