That can be made simpler than that: 

if (val->val2 == 0 && (val->val1 & (1 << 32 -1)) && val->type == Id::Type::BIGDEC)

No need for "toInt32"