Skip to content

Commit

Permalink
add target C int type information for msp430 target
Browse files Browse the repository at this point in the history
closes #1125
  • Loading branch information
andrewrk committed Jun 17, 2018
1 parent 7515187 commit e5956f2
Showing 1 changed file with 35 additions and 15 deletions.
50 changes: 35 additions & 15 deletions src/target.cpp
Expand Up @@ -686,21 +686,41 @@ static int get_arch_pointer_bit_width(ZigLLVM_ArchType arch) {
uint32_t target_c_type_size_in_bits(const ZigTarget *target, CIntType id) {
switch (target->os) {
case OsFreestanding:
switch (id) {
case CIntTypeShort:
case CIntTypeUShort:
return 16;
case CIntTypeInt:
case CIntTypeUInt:
return 32;
case CIntTypeLong:
case CIntTypeULong:
return get_arch_pointer_bit_width(target->arch.arch);
case CIntTypeLongLong:
case CIntTypeULongLong:
return 64;
case CIntTypeCount:
zig_unreachable();
switch (target->arch.arch) {
case ZigLLVM_msp430:
switch (id) {
case CIntTypeShort:
case CIntTypeUShort:
return 16;
case CIntTypeInt:
case CIntTypeUInt:
return 16;
case CIntTypeLong:
case CIntTypeULong:
return get_arch_pointer_bit_width(target->arch.arch);
case CIntTypeLongLong:
case CIntTypeULongLong:
return 64;
case CIntTypeCount:
zig_unreachable();
}
default:
switch (id) {
case CIntTypeShort:
case CIntTypeUShort:
return 16;
case CIntTypeInt:
case CIntTypeUInt:
return 32;
case CIntTypeLong:
case CIntTypeULong:
return get_arch_pointer_bit_width(target->arch.arch);
case CIntTypeLongLong:
case CIntTypeULongLong:
return 64;
case CIntTypeCount:
zig_unreachable();
}
}
case OsLinux:
case OsMacOSX:
Expand Down

0 comments on commit e5956f2

Please sign in to comment.