Yuki Suga / RTnoV4

Dependencies:   EthernetInterface mbed-rtos

TypeCode.cpp

Committer:
ysuga
Date:
2013-08-29
Revision:
7:6c7af1d50fb3
Parent:
0:5f7bc45bc2e8

File content as of revision 7:6c7af1d50fb3:

#include <ctype.h>

#include "TypeCode.h"

uint8_t TypeCode_isSequence(const char typeCode) {
  return isupper(typeCode);
}

uint8_t TypeCode_getElementSize(const char typeCode) {
  switch(tolower(typeCode)) {
  case 'b':
  case 'c':
  case 'o':
    return 1;
  case 's':
    return 2;
  case 'l':
  case 'f':
  case 'd': 
    return 4;

  default:
    return 4;
  }
}