Skip to content

Commit 067abc6

Browse files
committed
C_UTILS: Support UnsignedInt in get_print_type()
1 parent 0b3e1b2 commit 067abc6

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/libasr/codegen/c_utils.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,22 @@ class CCPPDSUtils {
471471
default: { throw LCompilersException("Integer kind not supported"); }
472472
}
473473
}
474+
case ASR::ttypeType::UnsignedInteger: {
475+
ASR::UnsignedInteger_t *ui = (ASR::UnsignedInteger_t*)t;
476+
switch (ui->m_kind) {
477+
case 1: { return "%u"; }
478+
case 2: { return "%u"; }
479+
case 4: { return "%u"; }
480+
case 8: {
481+
if (platform == Platform::Linux) {
482+
return "%lu";
483+
} else {
484+
return "%llu";
485+
}
486+
}
487+
default: { throw LCompilersException("Unsigned Integer kind not supported"); }
488+
}
489+
}
474490
case ASR::ttypeType::Real: {
475491
ASR::Real_t *r = (ASR::Real_t*)t;
476492
switch (r->m_kind) {

0 commit comments

Comments
 (0)