title: Is there a way to get rid of this switch and make it into a smaller block of code?
body: <p>I have this switch in my code and it takes up a ton of space. Is there a way to make it into a smaller block of code?</p>
  <pre><code>switch(datatype)
  {
      case OSMP_BYTE: // char
      {
          datatypeSize = sizeof(char);
          break;
      }
      case OSMP_INT: // int
      {
          datatypeSize = sizeof(int);
          break;
      }
      case OSMP_SHORT: // short int
      {
          datatypeSize = sizeof(short int);
          break;
      }
      case OSMP_LONG: // long int
      {
          datatypeSize = sizeof(long int);
          break;
      }
      case OSMP_UNSIGNED_CHAR: // unsigned char
      {
          datatypeSize = sizeof(unsigned char);
          break;
      }
      case OSMP_UNSIGNED: // unsigned int
      {
          datatypeSize = sizeof(unsigned int);
          break;
      }
      case OSMP_UNSIGNED_LONG: // unsigned long int
      {
          datatypeSize = sizeof(unsigned long int);
          break;
      }
      case OSMP_FLOAT: // float
      {
          datatypeSize = sizeof(float);
          break;
      }
      case OSMP_DOUBLE: // double
      {
          datatypeSize = sizeof(double);
          break;
      }
  
      default:
          break;
  }
  </code></pre>
  <p>My datatypes are defined like this:</p>
  <pre><code>typedef enum {
      OSMP_SHORT = 1,
      OSMP_INT,
      OSMP_LONG,
      OSMP_UNSIGNED_CHAR,
      OSMP_UNSIGNED,
      OSMP_UNSIGNED_LONG,
      OSMP_FLOAT,
      OSMP_DOUBLE,
      OSMP_BYTE
  } OSMP_Datatype;
  </code></pre>
  <p>If there is a way to make it smaller and fit better into my code, I'd really be helped.</p>