You are using a typemap to create an SV to return to perl. That SV is being assigned an integer value. The only types of integer values that SVs can have are IVs and UVs. Hence a plain integer gets upgraded to an IV/UV before being assigned to the SV.