LLVMConstant.st
changeset 68 a760b8536631
parent 67 996474cb0fe7
child 69 98f4cfe5d041
--- a/LLVMConstant.st	Mon Jun 20 09:17:32 2016 +0100
+++ b/LLVMConstant.st	Mon Jun 20 09:20:27 2016 +0100
@@ -104,10 +104,22 @@
 
 bitcast: value to: type
     self assertIsValue: value.
+    self assert: value type isPointerType description: 'Value is not a pointer type. Use #int:toPtr: to conver int to pointer'.
     self assertIsType: type.
     ^ LLVM ConstBitCast: value _: type.
 
     "Created: / 12-10-2015 / 16:11:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 20-06-2016 / 20:33:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+int: value toPtr: type
+    self assertIsValue: value.
+    self assert: value type isIntegerType description: 'Value is not an integer. Use #bitcast:to:'.
+    self assertIsType: type.
+
+    ^ LLVM ConstIntToPtr: value _: type.
+
+    "Created: / 20-06-2016 / 20:32:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !LLVMConstant class methodsFor:'constants - int - signed'!
@@ -206,9 +218,10 @@
     self assert: value isInteger.
     self assert: type isLLVMType.
     self assert: type isPointerType.
-    ^ self bitcast: (self uintptr: value) to: type
+    ^ self int: (self uintptr: value) toPtr: type
 
     "Created: / 19-06-2016 / 18:06:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 20-06-2016 / 20:33:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !LLVMConstant class methodsFor:'constants - strings'!