File tree Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -50,14 +50,12 @@ def self.type_to_nfi(type)
50
50
end
51
51
end
52
52
53
- def self . int_type ( size )
54
- case size
55
- when SIZEOF_INT
56
- Fiddle ::TYPE_INT
57
- when SIZEOF_LONG
53
+ def self . type_from_config ( type )
54
+ case type
55
+ when 'long'
58
56
Fiddle ::TYPE_LONG
59
57
else
60
- raise NotImplementedError , "no integer of size #{ size } "
58
+ raise NotImplementedError , "integer #{ type } not known "
61
59
end
62
60
end
63
61
@@ -140,10 +138,10 @@ class DLError < StandardError
140
138
SIZEOF_INTPTR_T = Truffle . invoke_primitive ( :pointer_find_type_size , :intptr_t )
141
139
SIZEOF_UINTPTR_T = Truffle . invoke_primitive ( :pointer_find_type_size , :uintptr_t )
142
140
143
- TYPE_SSIZE_T = Truffle ::FiddleBackend . int_type ( SIZEOF_SIZE_T )
141
+ TYPE_SSIZE_T = Truffle ::FiddleBackend . type_from_config ( Truffle :: Config . lookup ( 'platform.typedef.ssize_t' ) )
144
142
TYPE_SIZE_T = -1 * Truffle ::FiddleBackend ::SIGNEDNESS_OF_SIZE_T * TYPE_SSIZE_T
145
- TYPE_PTRDIFF_T = Truffle ::FiddleBackend . int_type ( SIZEOF_PTRDIFF_T )
146
- TYPE_INTPTR_T = Truffle ::FiddleBackend . int_type ( SIZEOF_INTPTR_T )
143
+ TYPE_PTRDIFF_T = Truffle ::FiddleBackend . type_from_config ( Truffle :: Config . lookup ( 'platform.typedef.ptrdiff_t' ) )
144
+ TYPE_INTPTR_T = Truffle ::FiddleBackend . type_from_config ( Truffle :: Config . lookup ( 'platform.typedef.intptr_t' ) )
147
145
TYPE_UINTPTR_T = -TYPE_INTPTR_T
148
146
149
147
# Alignment assumed to be the same as size
You can’t perform that action at this time.
0 commit comments