/// @file xed-machine-mode-enum.c

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

#include <string.h>
#include <assert.h>
#include "xed-machine-mode-enum.h"

typedef struct {
    const char* name;
    xed_machine_mode_enum_t value;
} name_table_xed_machine_mode_enum_t;
static const name_table_xed_machine_mode_enum_t name_array_xed_machine_mode_enum_t[] = {
{"INVALID", XED_MACHINE_MODE_INVALID},
{"LONG_64", XED_MACHINE_MODE_LONG_64},
{"LONG_COMPAT_32", XED_MACHINE_MODE_LONG_COMPAT_32},
{"LONG_COMPAT_16", XED_MACHINE_MODE_LONG_COMPAT_16},
{"LEGACY_32", XED_MACHINE_MODE_LEGACY_32},
{"LEGACY_16", XED_MACHINE_MODE_LEGACY_16},
{"REAL_16", XED_MACHINE_MODE_REAL_16},
{"REAL_32", XED_MACHINE_MODE_REAL_32},
{"LAST", XED_MACHINE_MODE_LAST},
{0, XED_MACHINE_MODE_LAST},
};

        
xed_machine_mode_enum_t str2xed_machine_mode_enum_t(const char* s)
{
   const name_table_xed_machine_mode_enum_t* p = name_array_xed_machine_mode_enum_t;
   while( p->name ) {
     if (strcmp(p->name,s) == 0) {
      return p->value;
     }
     p++;
   }
        

   return XED_MACHINE_MODE_INVALID;
}


const char* xed_machine_mode_enum_t2str(const xed_machine_mode_enum_t p)
{
   xed_machine_mode_enum_t type_idx = p;
   if ( p > XED_MACHINE_MODE_LAST) type_idx = XED_MACHINE_MODE_LAST;
   return name_array_xed_machine_mode_enum_t[type_idx].name;
}

xed_machine_mode_enum_t xed_machine_mode_enum_t_last(void) {
    return XED_MACHINE_MODE_LAST;
}
       
/*

Here is a skeleton switch statement embedded in a comment


  switch(p) {
  case XED_MACHINE_MODE_INVALID:
  case XED_MACHINE_MODE_LONG_64:
  case XED_MACHINE_MODE_LONG_COMPAT_32:
  case XED_MACHINE_MODE_LONG_COMPAT_16:
  case XED_MACHINE_MODE_LEGACY_32:
  case XED_MACHINE_MODE_LEGACY_16:
  case XED_MACHINE_MODE_REAL_16:
  case XED_MACHINE_MODE_REAL_32:
  case XED_MACHINE_MODE_LAST:
  default:
     xed_assert(0);
  }
*/
