Add ways to get the value of a ConstantInt

- property z_ext_value gets the zero-extended value using LLVMConstIntGetZExtValue
- property s_ext_value gets the sign-extended value using LLVMConstIntGetSExtValue
- add test case for both
This commit is contained in:
Wladimir J. van der Laan 2012-09-09 11:57:42 +02:00
commit 41953602bf
3 changed files with 28 additions and 2 deletions

View file

@ -461,6 +461,8 @@ _wLLVMConstReal(PyObject *self, PyObject *args)
}
_wrap_objstr2obj(LLVMConstRealOfString, LLVMTypeRef, LLVMValueRef)
_wrap_obj2obj(LLVMConstIntGetZExtValue, LLVMValueRef, llvmwrap_ull)
_wrap_obj2obj(LLVMConstIntGetSExtValue, LLVMValueRef, llvmwrap_ll)
/* Operations on composite constants */
@ -1580,6 +1582,8 @@ static PyMethodDef core_methods[] = {
_method( LLVMConstInt )
_method( LLVMConstReal )
_method( LLVMConstRealOfString )
_method( LLVMConstIntGetZExtValue )
_method( LLVMConstIntGetSExtValue )
/* Operations on composite constants */
_method( LLVMConstString )