aboutsummaryrefslogtreecommitdiffstats
path: root/common.c
diff options
context:
space:
mode:
Diffstat (limited to 'common.c')
-rw-r--r--common.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/common.c b/common.c
index 61cab15..6f74b1d 100644
--- a/common.c
+++ b/common.c
@@ -7,20 +7,20 @@
#include "common.h"
#include "pack.h"
-size_t getsize(char c)
+size_t getsize(enum pack_type t)
{
- switch (c) {
- case 'b': case 'B':
- case 'x':
+ switch (t) {
+ case PACK_TYPE_SCHAR: case PACK_TYPE_UCHAR:
+ case PACK_TYPE_PADDING:
return 1;
- case 'h': case 'H':
- case 'i': case 'I':
+ case PACK_TYPE_SHORT: case PACK_TYPE_USHORT:
+ case PACK_TYPE_INT: case PACK_TYPE_UINT:
return 2;
- case 'l': case 'L':
- case 'f':
+ case PACK_TYPE_LONG: case PACK_TYPE_ULONG:
+ case PACK_TYPE_FLOAT:
return 4;
- case 'q': case 'Q':
- case 'd':
+ case PACK_TYPE_LLONG: case PACK_TYPE_ULLONG:
+ case PACK_TYPE_DOUBLE:
return 8;
default: return (size_t)-1;
}