Module: Carbon::Core::Pointer::Cast Private
- Included in:
- Carbon::Core::Pointer
- Defined in:
- lib/carbon/core/pointer/cast.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Performs casting for pointers. This converts them into an integer for use in the program. This defines the following functions on the pointer type:
.to-int64(self): Carbon::Int64
.to-uint64(self): Carbon::UInt64
.to-int32(self): Carbon::Int32
.to-uint32(self): Carbon::UInt32
.to-int16(self): Carbon::Int16
.to-uint16(self): Carbon::UInt16
.to-int8(self): Carbon::Int8
.to-uint8(self): Carbon::UInt8
Instance Method Summary collapse
-
#define_cast_function(int) ⇒ void
private
Defines a cast function for a given integer type.
-
#define_cast_functions ⇒ void
private
Defines all of the cast functions for all of the integer types.
Instance Method Details
#define_cast_function(int) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Defines a cast function for a given integer type.
35 36 37 38 39 40 41 |
# File 'lib/carbon/core/pointer/cast.rb', line 35 def define_cast_function(int) function_name = PTYPE.call(int.cast, [PTYPE]) Core.define(function: function_name) do |function| function[:return] = int.name define_cast_definition(int, function[:definition]) end end |
#define_cast_functions ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Defines all of the cast functions for all of the integer types.
24 25 26 27 28 29 |
# File 'lib/carbon/core/pointer/cast.rb', line 24 def define_cast_functions Ints.each do |int| next if int.size == 1 define_cast_function(int) end end |