src/devices/block/bin/gpt/gpt.cc
// ParseSize parses long integers in base 10, expanding p, t, g, m, and k
// suffices as binary byte scales. If the suffix is %, the value is returned as
// negative, in order to indicate a proportion.
ParseSize parses long integers in base 10, expanding p, t, g, m, and k
suffices as binary byte scales. If the suffix is %, the value is returned as
negative, in order to indicate a proportion.
ParseSize parses long integers in base 10 expanding p t g m and k suffices as binary byte scales . If the suffix is % the value is returned as negative in order to indicate a proportion .
int64_t ParseSize(char* s) {
  char* end = s;
  long long int v = strtoll(s, &end, 10);
  switch (*end) {
    case 0:
      break;
    case '%':
      v = -v;
      break;
    case 'p':
    case 'P':
      v *= 1024;
      __FALLTHROUGH;
    case 't':
    case 'T':
      v *= 1024;
      __FALLTHROUGH;
    case 'g':
    case 'G':
      v *= 1024;
      __FALLTHROUGH;
    case 'm':
    case 'M':
      v *= 1024;
      __FALLTHROUGH;
    case 'k':
    case 'K':
      v *= 1024;
  }
  return v;
}
int64_t ParseSize ( char * s ) { char * end = s ; long long int v = strtoll ( s , & end , 10 ) ; switch ( * end ) { case 0 : break ; case ' ' : v = - v ; break ; case ' ' : case ' ' : v *= 1024 ; __FALLTHROUGH ; case ' ' : case ' ' : v *= 1024 ; __FALLTHROUGH ; case ' ' : case ' ' : v *= 1024 ; __FALLTHROUGH ; case ' ' : case ' ' : v *= 1024 ; __FALLTHROUGH ; case ' ' : case ' ' : v *= 1024 ; } return v ; }
ParseSize parses long integers in base 10, expanding p, t, g, m, and k
suffices as binary byte scales.
ParseSize parses long integers in base 10 expanding p t g m and k suffices as binary byte scales .