Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add constant int_to_ptr and ptr_to_int.

  • Loading branch information...
commit 92321f5660183700aa03c58f90e1a6b2fa58bbd5 1 parent ed0389f
@whitequark whitequark authored
Showing with 11 additions and 2 deletions.
  1. +11 −2 lib/llvm/core/value.rb
View
13 lib/llvm/core/value.rb
@@ -219,6 +219,9 @@ def bitcast_to(type)
ConstantExpr.from_ptr(C.const_bit_cast(self, type))
end
+ # @deprecated
+ alias bit_cast bitcast_to
+
# Returns the element pointer at the given indices of the constant.
# For more information on gep go to: http://llvm.org/docs/GetElementPtr.html
def gep(*indices)
@@ -230,8 +233,9 @@ def gep(*indices)
end
end
- def bit_cast(type)
- return ConstantExpr.from_ptr(C.const_bit_cast(self, type))
+ # Conversion to integer.
+ def ptr_to_int(type)
+ ConstantInt.from_ptr(C.const_ptr_to_int(self, type))
end
end
@@ -435,6 +439,11 @@ def ashr(bits)
def icmp(pred, rhs)
self.class.from_ptr(C.const_i_cmp(pred, self, rhs))
end
+
+ # Conversion to pointer.
+ def int_to_ptr(type)
+ ConstantExpr.from_ptr(C.const_int_to_ptr(self, type))
+ end
end
def LLVM.const_missing(const)
Please sign in to comment.
Something went wrong with that request. Please try again.