Skip to content

Commit

Permalink
Use int32_t style for ints
Browse files Browse the repository at this point in the history
  • Loading branch information
certik committed May 19, 2022
1 parent 0a52b33 commit 9f56541
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/libasr/codegen/asr_to_c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,16 @@ class ASRToCVisitor : public BaseCCPPVisitor<ASRToCVisitor>
if (ASRUtils::is_integer(*v.m_type)) {
ASR::Integer_t *t = ASR::down_cast<ASR::Integer_t>(v.m_type);
std::string dims = convert_dims_c(t->n_dims, t->m_dims);
std::string type_name = "int";
if (t->m_kind == 8) type_name = "long long";
std::string type_name;
if (t->m_kind == 1) {
type_name = "int8_t";
} else if (t->m_kind == 2) {
type_name = "int16_t";
} else if (t->m_kind == 4) {
type_name = "int32_t";
} else if (t->m_kind == 8) {
type_name = "int64_t";
}
sub = format_type_c(dims, type_name, v.m_name, use_ref, dummy);
} else if (ASRUtils::is_real(*v.m_type)) {
ASR::Real_t *t = ASR::down_cast<ASR::Real_t>(v.m_type);
Expand All @@ -100,7 +108,7 @@ class ASRToCVisitor : public BaseCCPPVisitor<ASRToCVisitor>
} else if (ASRUtils::is_logical(*v.m_type)) {
ASR::Logical_t *t = ASR::down_cast<ASR::Logical_t>(v.m_type);
std::string dims = convert_dims_c(t->n_dims, t->m_dims);
sub = format_type_c(dims, "bool", v.m_name, use_ref, dummy);
sub = format_type_c(dims, "int8_t", v.m_name, use_ref, dummy);
} else if (ASRUtils::is_character(*v.m_type)) {
// TODO
} else if (ASR::is_a<ASR::Derived_t>(*v.m_type)) {
Expand Down

0 comments on commit 9f56541

Please sign in to comment.