Skip to content

Commit 9fc7578

Browse files
committed
C_CPP: Explicitly cast unsigned operations in C
1 parent 93de343 commit 9fc7578

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/libasr/codegen/asr_to_c_cpp.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2190,6 +2190,8 @@ PyMODINIT_FUNC PyInit_lpython_module_)" + fn_name + R"((void) {
21902190

21912191
void visit_UnsignedIntegerBinOp(const ASR::UnsignedIntegerBinOp_t &x) {
21922192
handle_BinOp(x);
2193+
int kind = ASRUtils::extract_kind_from_ttype_t(x.m_type);
2194+
src = "(uint" + std::to_string(kind * 8) + "_t)(" + src + ")";
21932195
}
21942196

21952197
void visit_RealBinOp(const ASR::RealBinOp_t &x) {

0 commit comments

Comments
 (0)