opencl_ruby_ffi 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,299 +1,28 @@
1
1
  module OpenCL
2
- # Maps the cl_char type of OpenCL
3
- class Char < FFI::Struct
4
- @size = FFI.find_type(:cl_char).size * 1
5
- @layout = FFI::StructLayout::new([ FFI::StructLayout::Field::new( "s0", FFI.find_type(:cl_char).size * 0, FFI.find_type(:cl_char) ) ], FFI.find_type(:cl_char).size * 1, FFI.find_type(:cl_char).size * 1 )
6
- # Creates a new Char with members set to 0 or to the user specified values
7
- def initialize( s0 = 0 )
8
- super()
9
- self[:s0] = s0
10
- end
11
- # Reads the s0 member
12
- def s0
13
- return self[:s0]
14
- end
15
- # Sets the s0 member to value
16
- def s0=(value)
17
- self[:s0] = value
18
- end
19
-
20
- def inspect
21
- return "#<#{self.class.name}: #{self[:s0]}>"
22
- end
23
-
24
- def to_s
25
- return "Char{ #{self[:s0]} }"
26
- end
27
- end
28
- # Maps the cl_uchar type of OpenCL
29
- class UChar < FFI::Struct
30
- @size = FFI.find_type(:cl_uchar).size * 1
31
- @layout = FFI::StructLayout::new([ FFI::StructLayout::Field::new( "s0", FFI.find_type(:cl_uchar).size * 0, FFI.find_type(:cl_uchar) ) ], FFI.find_type(:cl_uchar).size * 1, FFI.find_type(:cl_uchar).size * 1 )
32
- # Creates a new UChar with members set to 0 or to the user specified values
33
- def initialize( s0 = 0 )
34
- super()
35
- self[:s0] = s0
36
- end
37
- # Reads the s0 member
38
- def s0
39
- return self[:s0]
40
- end
41
- # Sets the s0 member to value
42
- def s0=(value)
43
- self[:s0] = value
44
- end
45
-
46
- def inspect
47
- return "#<#{self.class.name}: #{self[:s0]}>"
48
- end
49
-
50
- def to_s
51
- return "UChar{ #{self[:s0]} }"
52
- end
53
- end
54
- # Maps the cl_short type of OpenCL
55
- class Short < FFI::Struct
56
- @size = FFI.find_type(:cl_short).size * 1
57
- @layout = FFI::StructLayout::new([ FFI::StructLayout::Field::new( "s0", FFI.find_type(:cl_short).size * 0, FFI.find_type(:cl_short) ) ], FFI.find_type(:cl_short).size * 1, FFI.find_type(:cl_short).size * 1 )
58
- # Creates a new Short with members set to 0 or to the user specified values
59
- def initialize( s0 = 0 )
60
- super()
61
- self[:s0] = s0
62
- end
63
- # Reads the s0 member
64
- def s0
65
- return self[:s0]
66
- end
67
- # Sets the s0 member to value
68
- def s0=(value)
69
- self[:s0] = value
70
- end
71
-
72
- def inspect
73
- return "#<#{self.class.name}: #{self[:s0]}>"
74
- end
75
-
76
- def to_s
77
- return "Short{ #{self[:s0]} }"
78
- end
79
- end
80
- # Maps the cl_ushort type of OpenCL
81
- class UShort < FFI::Struct
82
- @size = FFI.find_type(:cl_ushort).size * 1
83
- @layout = FFI::StructLayout::new([ FFI::StructLayout::Field::new( "s0", FFI.find_type(:cl_ushort).size * 0, FFI.find_type(:cl_ushort) ) ], FFI.find_type(:cl_ushort).size * 1, FFI.find_type(:cl_ushort).size * 1 )
84
- # Creates a new UShort with members set to 0 or to the user specified values
85
- def initialize( s0 = 0 )
86
- super()
87
- self[:s0] = s0
88
- end
89
- # Reads the s0 member
90
- def s0
91
- return self[:s0]
92
- end
93
- # Sets the s0 member to value
94
- def s0=(value)
95
- self[:s0] = value
96
- end
97
-
98
- def inspect
99
- return "#<#{self.class.name}: #{self[:s0]}>"
100
- end
101
-
102
- def to_s
103
- return "UShort{ #{self[:s0]} }"
104
- end
105
- end
106
- # Maps the cl_int type of OpenCL
107
- class Int < FFI::Struct
108
- @size = FFI.find_type(:cl_int).size * 1
109
- @layout = FFI::StructLayout::new([ FFI::StructLayout::Field::new( "s0", FFI.find_type(:cl_int).size * 0, FFI.find_type(:cl_int) ) ], FFI.find_type(:cl_int).size * 1, FFI.find_type(:cl_int).size * 1 )
110
- # Creates a new Int with members set to 0 or to the user specified values
111
- def initialize( s0 = 0 )
112
- super()
113
- self[:s0] = s0
114
- end
115
- # Reads the s0 member
116
- def s0
117
- return self[:s0]
118
- end
119
- # Sets the s0 member to value
120
- def s0=(value)
121
- self[:s0] = value
122
- end
123
-
124
- def inspect
125
- return "#<#{self.class.name}: #{self[:s0]}>"
126
- end
127
-
128
- def to_s
129
- return "Int{ #{self[:s0]} }"
130
- end
131
- end
132
- # Maps the cl_uint type of OpenCL
133
- class UInt < FFI::Struct
134
- @size = FFI.find_type(:cl_uint).size * 1
135
- @layout = FFI::StructLayout::new([ FFI::StructLayout::Field::new( "s0", FFI.find_type(:cl_uint).size * 0, FFI.find_type(:cl_uint) ) ], FFI.find_type(:cl_uint).size * 1, FFI.find_type(:cl_uint).size * 1 )
136
- # Creates a new UInt with members set to 0 or to the user specified values
137
- def initialize( s0 = 0 )
138
- super()
139
- self[:s0] = s0
140
- end
141
- # Reads the s0 member
142
- def s0
143
- return self[:s0]
144
- end
145
- # Sets the s0 member to value
146
- def s0=(value)
147
- self[:s0] = value
148
- end
149
-
150
- def inspect
151
- return "#<#{self.class.name}: #{self[:s0]}>"
152
- end
153
-
154
- def to_s
155
- return "UInt{ #{self[:s0]} }"
156
- end
157
- end
158
- # Maps the cl_long type of OpenCL
159
- class Long < FFI::Struct
160
- @size = FFI.find_type(:cl_long).size * 1
161
- @layout = FFI::StructLayout::new([ FFI::StructLayout::Field::new( "s0", FFI.find_type(:cl_long).size * 0, FFI.find_type(:cl_long) ) ], FFI.find_type(:cl_long).size * 1, FFI.find_type(:cl_long).size * 1 )
162
- # Creates a new Long with members set to 0 or to the user specified values
163
- def initialize( s0 = 0 )
164
- super()
165
- self[:s0] = s0
166
- end
167
- # Reads the s0 member
168
- def s0
169
- return self[:s0]
170
- end
171
- # Sets the s0 member to value
172
- def s0=(value)
173
- self[:s0] = value
174
- end
175
-
176
- def inspect
177
- return "#<#{self.class.name}: #{self[:s0]}>"
178
- end
179
-
180
- def to_s
181
- return "Long{ #{self[:s0]} }"
182
- end
183
- end
184
- # Maps the cl_ulong type of OpenCL
185
- class ULong < FFI::Struct
186
- @size = FFI.find_type(:cl_ulong).size * 1
187
- @layout = FFI::StructLayout::new([ FFI::StructLayout::Field::new( "s0", FFI.find_type(:cl_ulong).size * 0, FFI.find_type(:cl_ulong) ) ], FFI.find_type(:cl_ulong).size * 1, FFI.find_type(:cl_ulong).size * 1 )
188
- # Creates a new ULong with members set to 0 or to the user specified values
189
- def initialize( s0 = 0 )
190
- super()
191
- self[:s0] = s0
192
- end
193
- # Reads the s0 member
194
- def s0
195
- return self[:s0]
196
- end
197
- # Sets the s0 member to value
198
- def s0=(value)
199
- self[:s0] = value
200
- end
201
-
202
- def inspect
203
- return "#<#{self.class.name}: #{self[:s0]}>"
204
- end
205
-
206
- def to_s
207
- return "ULong{ #{self[:s0]} }"
208
- end
209
- end
210
- # Maps the cl_float type of OpenCL
211
- class Float < FFI::Struct
212
- @size = FFI.find_type(:cl_float).size * 1
213
- @layout = FFI::StructLayout::new([ FFI::StructLayout::Field::new( "s0", FFI.find_type(:cl_float).size * 0, FFI.find_type(:cl_float) ) ], FFI.find_type(:cl_float).size * 1, FFI.find_type(:cl_float).size * 1 )
214
- # Creates a new Float with members set to 0 or to the user specified values
215
- def initialize( s0 = 0.0 )
216
- super()
217
- self[:s0] = s0
218
- end
219
- # Reads the s0 member
220
- def s0
221
- return self[:s0]
222
- end
223
- # Sets the s0 member to value
224
- def s0=(value)
225
- self[:s0] = value
226
- end
227
-
228
- def inspect
229
- return "#<#{self.class.name}: #{self[:s0]}>"
230
- end
231
-
232
- def to_s
233
- return "Float{ #{self[:s0]} }"
234
- end
235
- end
236
- # Maps the cl_double type of OpenCL
237
- class Double < FFI::Struct
238
- @size = FFI.find_type(:cl_double).size * 1
239
- @layout = FFI::StructLayout::new([ FFI::StructLayout::Field::new( "s0", FFI.find_type(:cl_double).size * 0, FFI.find_type(:cl_double) ) ], FFI.find_type(:cl_double).size * 1, FFI.find_type(:cl_double).size * 1 )
240
- # Creates a new Double with members set to 0 or to the user specified values
241
- def initialize( s0 = 0.0 )
242
- super()
243
- self[:s0] = s0
244
- end
245
- # Reads the s0 member
246
- def s0
247
- return self[:s0]
248
- end
249
- # Sets the s0 member to value
250
- def s0=(value)
251
- self[:s0] = value
252
- end
253
-
254
- def inspect
255
- return "#<#{self.class.name}: #{self[:s0]}>"
256
- end
257
-
258
- def to_s
259
- return "Double{ #{self[:s0]} }"
260
- end
261
- end
262
- # Maps the cl_half type of OpenCL
263
- class Half < FFI::Struct
264
- @size = FFI.find_type(:cl_half).size * 1
265
- @layout = FFI::StructLayout::new([ FFI::StructLayout::Field::new( "s0", FFI.find_type(:cl_half).size * 0, FFI.find_type(:cl_half) ) ], FFI.find_type(:cl_half).size * 1, FFI.find_type(:cl_half).size * 1 )
266
- # Creates a new Half with members set to 0 or to the user specified values
267
- def initialize( s0 = 0.0 )
268
- super()
269
- self[:s0] = s0
270
- end
271
- # Reads the s0 member
272
- def s0
273
- return self[:s0]
274
- end
275
- # Sets the s0 member to value
276
- def s0=(value)
277
- self[:s0] = value
278
- end
279
-
280
- def inspect
281
- return "#<#{self.class.name}: #{self[:s0]}>"
282
- end
283
-
284
- def to_s
285
- return "Half{ #{self[:s0]} }"
286
- end
287
- end
2
+ Char = OpenCL.find_type(:cl_char)
3
+ UChar = OpenCL.find_type(:cl_uchar)
4
+ Short = OpenCL.find_type(:cl_short)
5
+ UShort = OpenCL.find_type(:cl_ushort)
6
+ Int = OpenCL.find_type(:cl_int)
7
+ UInt = OpenCL.find_type(:cl_uint)
8
+ Long = OpenCL.find_type(:cl_long)
9
+ ULong = OpenCL.find_type(:cl_ulong)
10
+ Float = OpenCL.find_type(:cl_float)
11
+ Double = OpenCL.find_type(:cl_double)
12
+ Half = OpenCL.find_type(:cl_half)
288
13
  # Maps the cl_char2 type of OpenCL
289
- class Char2 < FFI::Struct
290
- @size = FFI.find_type(:cl_char).size * 2
291
- @layout = FFI::StructLayout::new([ FFI::StructLayout::Field::new( "s0", FFI.find_type(:cl_char).size * 0, FFI.find_type(:cl_char) ), FFI::StructLayout::Field::new( "s1", FFI.find_type(:cl_char).size * 1, FFI.find_type(:cl_char) ) ], FFI.find_type(:cl_char).size * 2, FFI.find_type(:cl_char).size * 2 )
292
- # Creates a new Char2 with members set to 0 or to the user specified values
14
+ class Char2 < Struct
15
+ @size = OpenCL.find_type(:cl_char).size * 2
16
+ @layout = OpenCL::StructLayout::new([ OpenCL::StructLayout::Field::new( "s0", OpenCL.find_type(:cl_char).size * 0, OpenCL.find_type(:cl_char) ), OpenCL::StructLayout::Field::new( "s1", OpenCL.find_type(:cl_char).size * 1, OpenCL.find_type(:cl_char) ) ], OpenCL.find_type(:cl_char).size * 2, OpenCL.find_type(:cl_char).size * 2 )
17
+ # Creates a new Char2 with members set to 0 or to the user specified values. If a Pointer is passed as the first argument, Char2 maps the memory pointed.
293
18
  def initialize( s0 = 0, s1 = 0 )
294
- super()
295
- self[:s0] = s0
296
- self[:s1] = s1
19
+ if s0.is_a?(FFI::Pointer) then
20
+ super(s0)
21
+ else
22
+ super()
23
+ self[:s0] = s0
24
+ self[:s1] = s1
25
+ end
297
26
  end
298
27
  # Reads the s0 member
299
28
  def s0
@@ -321,14 +50,18 @@ module OpenCL
321
50
  end
322
51
  end
323
52
  # Maps the cl_uchar2 type of OpenCL
324
- class UChar2 < FFI::Struct
325
- @size = FFI.find_type(:cl_uchar).size * 2
326
- @layout = FFI::StructLayout::new([ FFI::StructLayout::Field::new( "s0", FFI.find_type(:cl_uchar).size * 0, FFI.find_type(:cl_uchar) ), FFI::StructLayout::Field::new( "s1", FFI.find_type(:cl_uchar).size * 1, FFI.find_type(:cl_uchar) ) ], FFI.find_type(:cl_uchar).size * 2, FFI.find_type(:cl_uchar).size * 2 )
327
- # Creates a new UChar2 with members set to 0 or to the user specified values
53
+ class UChar2 < Struct
54
+ @size = OpenCL.find_type(:cl_uchar).size * 2
55
+ @layout = OpenCL::StructLayout::new([ OpenCL::StructLayout::Field::new( "s0", OpenCL.find_type(:cl_uchar).size * 0, OpenCL.find_type(:cl_uchar) ), OpenCL::StructLayout::Field::new( "s1", OpenCL.find_type(:cl_uchar).size * 1, OpenCL.find_type(:cl_uchar) ) ], OpenCL.find_type(:cl_uchar).size * 2, OpenCL.find_type(:cl_uchar).size * 2 )
56
+ # Creates a new UChar2 with members set to 0 or to the user specified values. If a Pointer is passed as the first argument, UChar2 maps the memory pointed.
328
57
  def initialize( s0 = 0, s1 = 0 )
329
- super()
330
- self[:s0] = s0
331
- self[:s1] = s1
58
+ if s0.is_a?(FFI::Pointer) then
59
+ super(s0)
60
+ else
61
+ super()
62
+ self[:s0] = s0
63
+ self[:s1] = s1
64
+ end
332
65
  end
333
66
  # Reads the s0 member
334
67
  def s0
@@ -356,14 +89,18 @@ module OpenCL
356
89
  end
357
90
  end
358
91
  # Maps the cl_short2 type of OpenCL
359
- class Short2 < FFI::Struct
360
- @size = FFI.find_type(:cl_short).size * 2
361
- @layout = FFI::StructLayout::new([ FFI::StructLayout::Field::new( "s0", FFI.find_type(:cl_short).size * 0, FFI.find_type(:cl_short) ), FFI::StructLayout::Field::new( "s1", FFI.find_type(:cl_short).size * 1, FFI.find_type(:cl_short) ) ], FFI.find_type(:cl_short).size * 2, FFI.find_type(:cl_short).size * 2 )
362
- # Creates a new Short2 with members set to 0 or to the user specified values
92
+ class Short2 < Struct
93
+ @size = OpenCL.find_type(:cl_short).size * 2
94
+ @layout = OpenCL::StructLayout::new([ OpenCL::StructLayout::Field::new( "s0", OpenCL.find_type(:cl_short).size * 0, OpenCL.find_type(:cl_short) ), OpenCL::StructLayout::Field::new( "s1", OpenCL.find_type(:cl_short).size * 1, OpenCL.find_type(:cl_short) ) ], OpenCL.find_type(:cl_short).size * 2, OpenCL.find_type(:cl_short).size * 2 )
95
+ # Creates a new Short2 with members set to 0 or to the user specified values. If a Pointer is passed as the first argument, Short2 maps the memory pointed.
363
96
  def initialize( s0 = 0, s1 = 0 )
364
- super()
365
- self[:s0] = s0
366
- self[:s1] = s1
97
+ if s0.is_a?(FFI::Pointer) then
98
+ super(s0)
99
+ else
100
+ super()
101
+ self[:s0] = s0
102
+ self[:s1] = s1
103
+ end
367
104
  end
368
105
  # Reads the s0 member
369
106
  def s0
@@ -391,14 +128,18 @@ module OpenCL
391
128
  end
392
129
  end
393
130
  # Maps the cl_ushort2 type of OpenCL
394
- class UShort2 < FFI::Struct
395
- @size = FFI.find_type(:cl_ushort).size * 2
396
- @layout = FFI::StructLayout::new([ FFI::StructLayout::Field::new( "s0", FFI.find_type(:cl_ushort).size * 0, FFI.find_type(:cl_ushort) ), FFI::StructLayout::Field::new( "s1", FFI.find_type(:cl_ushort).size * 1, FFI.find_type(:cl_ushort) ) ], FFI.find_type(:cl_ushort).size * 2, FFI.find_type(:cl_ushort).size * 2 )
397
- # Creates a new UShort2 with members set to 0 or to the user specified values
131
+ class UShort2 < Struct
132
+ @size = OpenCL.find_type(:cl_ushort).size * 2
133
+ @layout = OpenCL::StructLayout::new([ OpenCL::StructLayout::Field::new( "s0", OpenCL.find_type(:cl_ushort).size * 0, OpenCL.find_type(:cl_ushort) ), OpenCL::StructLayout::Field::new( "s1", OpenCL.find_type(:cl_ushort).size * 1, OpenCL.find_type(:cl_ushort) ) ], OpenCL.find_type(:cl_ushort).size * 2, OpenCL.find_type(:cl_ushort).size * 2 )
134
+ # Creates a new UShort2 with members set to 0 or to the user specified values. If a Pointer is passed as the first argument, UShort2 maps the memory pointed.
398
135
  def initialize( s0 = 0, s1 = 0 )
399
- super()
400
- self[:s0] = s0
401
- self[:s1] = s1
136
+ if s0.is_a?(FFI::Pointer) then
137
+ super(s0)
138
+ else
139
+ super()
140
+ self[:s0] = s0
141
+ self[:s1] = s1
142
+ end
402
143
  end
403
144
  # Reads the s0 member
404
145
  def s0
@@ -426,14 +167,18 @@ module OpenCL
426
167
  end
427
168
  end
428
169
  # Maps the cl_int2 type of OpenCL
429
- class Int2 < FFI::Struct
430
- @size = FFI.find_type(:cl_int).size * 2
431
- @layout = FFI::StructLayout::new([ FFI::StructLayout::Field::new( "s0", FFI.find_type(:cl_int).size * 0, FFI.find_type(:cl_int) ), FFI::StructLayout::Field::new( "s1", FFI.find_type(:cl_int).size * 1, FFI.find_type(:cl_int) ) ], FFI.find_type(:cl_int).size * 2, FFI.find_type(:cl_int).size * 2 )
432
- # Creates a new Int2 with members set to 0 or to the user specified values
170
+ class Int2 < Struct
171
+ @size = OpenCL.find_type(:cl_int).size * 2
172
+ @layout = OpenCL::StructLayout::new([ OpenCL::StructLayout::Field::new( "s0", OpenCL.find_type(:cl_int).size * 0, OpenCL.find_type(:cl_int) ), OpenCL::StructLayout::Field::new( "s1", OpenCL.find_type(:cl_int).size * 1, OpenCL.find_type(:cl_int) ) ], OpenCL.find_type(:cl_int).size * 2, OpenCL.find_type(:cl_int).size * 2 )
173
+ # Creates a new Int2 with members set to 0 or to the user specified values. If a Pointer is passed as the first argument, Int2 maps the memory pointed.
433
174
  def initialize( s0 = 0, s1 = 0 )
434
- super()
435
- self[:s0] = s0
436
- self[:s1] = s1
175
+ if s0.is_a?(FFI::Pointer) then
176
+ super(s0)
177
+ else
178
+ super()
179
+ self[:s0] = s0
180
+ self[:s1] = s1
181
+ end
437
182
  end
438
183
  # Reads the s0 member
439
184
  def s0
@@ -461,14 +206,18 @@ module OpenCL
461
206
  end
462
207
  end
463
208
  # Maps the cl_uint2 type of OpenCL
464
- class UInt2 < FFI::Struct
465
- @size = FFI.find_type(:cl_uint).size * 2
466
- @layout = FFI::StructLayout::new([ FFI::StructLayout::Field::new( "s0", FFI.find_type(:cl_uint).size * 0, FFI.find_type(:cl_uint) ), FFI::StructLayout::Field::new( "s1", FFI.find_type(:cl_uint).size * 1, FFI.find_type(:cl_uint) ) ], FFI.find_type(:cl_uint).size * 2, FFI.find_type(:cl_uint).size * 2 )
467
- # Creates a new UInt2 with members set to 0 or to the user specified values
209
+ class UInt2 < Struct
210
+ @size = OpenCL.find_type(:cl_uint).size * 2
211
+ @layout = OpenCL::StructLayout::new([ OpenCL::StructLayout::Field::new( "s0", OpenCL.find_type(:cl_uint).size * 0, OpenCL.find_type(:cl_uint) ), OpenCL::StructLayout::Field::new( "s1", OpenCL.find_type(:cl_uint).size * 1, OpenCL.find_type(:cl_uint) ) ], OpenCL.find_type(:cl_uint).size * 2, OpenCL.find_type(:cl_uint).size * 2 )
212
+ # Creates a new UInt2 with members set to 0 or to the user specified values. If a Pointer is passed as the first argument, UInt2 maps the memory pointed.
468
213
  def initialize( s0 = 0, s1 = 0 )
469
- super()
470
- self[:s0] = s0
471
- self[:s1] = s1
214
+ if s0.is_a?(FFI::Pointer) then
215
+ super(s0)
216
+ else
217
+ super()
218
+ self[:s0] = s0
219
+ self[:s1] = s1
220
+ end
472
221
  end
473
222
  # Reads the s0 member
474
223
  def s0
@@ -496,14 +245,18 @@ module OpenCL
496
245
  end
497
246
  end
498
247
  # Maps the cl_long2 type of OpenCL
499
- class Long2 < FFI::Struct
500
- @size = FFI.find_type(:cl_long).size * 2
501
- @layout = FFI::StructLayout::new([ FFI::StructLayout::Field::new( "s0", FFI.find_type(:cl_long).size * 0, FFI.find_type(:cl_long) ), FFI::StructLayout::Field::new( "s1", FFI.find_type(:cl_long).size * 1, FFI.find_type(:cl_long) ) ], FFI.find_type(:cl_long).size * 2, FFI.find_type(:cl_long).size * 2 )
502
- # Creates a new Long2 with members set to 0 or to the user specified values
248
+ class Long2 < Struct
249
+ @size = OpenCL.find_type(:cl_long).size * 2
250
+ @layout = OpenCL::StructLayout::new([ OpenCL::StructLayout::Field::new( "s0", OpenCL.find_type(:cl_long).size * 0, OpenCL.find_type(:cl_long) ), OpenCL::StructLayout::Field::new( "s1", OpenCL.find_type(:cl_long).size * 1, OpenCL.find_type(:cl_long) ) ], OpenCL.find_type(:cl_long).size * 2, OpenCL.find_type(:cl_long).size * 2 )
251
+ # Creates a new Long2 with members set to 0 or to the user specified values. If a Pointer is passed as the first argument, Long2 maps the memory pointed.
503
252
  def initialize( s0 = 0, s1 = 0 )
504
- super()
505
- self[:s0] = s0
506
- self[:s1] = s1
253
+ if s0.is_a?(FFI::Pointer) then
254
+ super(s0)
255
+ else
256
+ super()
257
+ self[:s0] = s0
258
+ self[:s1] = s1
259
+ end
507
260
  end
508
261
  # Reads the s0 member
509
262
  def s0
@@ -531,14 +284,18 @@ module OpenCL
531
284
  end
532
285
  end
533
286
  # Maps the cl_ulong2 type of OpenCL
534
- class ULong2 < FFI::Struct
535
- @size = FFI.find_type(:cl_ulong).size * 2
536
- @layout = FFI::StructLayout::new([ FFI::StructLayout::Field::new( "s0", FFI.find_type(:cl_ulong).size * 0, FFI.find_type(:cl_ulong) ), FFI::StructLayout::Field::new( "s1", FFI.find_type(:cl_ulong).size * 1, FFI.find_type(:cl_ulong) ) ], FFI.find_type(:cl_ulong).size * 2, FFI.find_type(:cl_ulong).size * 2 )
537
- # Creates a new ULong2 with members set to 0 or to the user specified values
287
+ class ULong2 < Struct
288
+ @size = OpenCL.find_type(:cl_ulong).size * 2
289
+ @layout = OpenCL::StructLayout::new([ OpenCL::StructLayout::Field::new( "s0", OpenCL.find_type(:cl_ulong).size * 0, OpenCL.find_type(:cl_ulong) ), OpenCL::StructLayout::Field::new( "s1", OpenCL.find_type(:cl_ulong).size * 1, OpenCL.find_type(:cl_ulong) ) ], OpenCL.find_type(:cl_ulong).size * 2, OpenCL.find_type(:cl_ulong).size * 2 )
290
+ # Creates a new ULong2 with members set to 0 or to the user specified values. If a Pointer is passed as the first argument, ULong2 maps the memory pointed.
538
291
  def initialize( s0 = 0, s1 = 0 )
539
- super()
540
- self[:s0] = s0
541
- self[:s1] = s1
292
+ if s0.is_a?(FFI::Pointer) then
293
+ super(s0)
294
+ else
295
+ super()
296
+ self[:s0] = s0
297
+ self[:s1] = s1
298
+ end
542
299
  end
543
300
  # Reads the s0 member
544
301
  def s0
@@ -566,14 +323,18 @@ module OpenCL
566
323
  end
567
324
  end
568
325
  # Maps the cl_float2 type of OpenCL
569
- class Float2 < FFI::Struct
570
- @size = FFI.find_type(:cl_float).size * 2
571
- @layout = FFI::StructLayout::new([ FFI::StructLayout::Field::new( "s0", FFI.find_type(:cl_float).size * 0, FFI.find_type(:cl_float) ), FFI::StructLayout::Field::new( "s1", FFI.find_type(:cl_float).size * 1, FFI.find_type(:cl_float) ) ], FFI.find_type(:cl_float).size * 2, FFI.find_type(:cl_float).size * 2 )
572
- # Creates a new Float2 with members set to 0 or to the user specified values
326
+ class Float2 < Struct
327
+ @size = OpenCL.find_type(:cl_float).size * 2
328
+ @layout = OpenCL::StructLayout::new([ OpenCL::StructLayout::Field::new( "s0", OpenCL.find_type(:cl_float).size * 0, OpenCL.find_type(:cl_float) ), OpenCL::StructLayout::Field::new( "s1", OpenCL.find_type(:cl_float).size * 1, OpenCL.find_type(:cl_float) ) ], OpenCL.find_type(:cl_float).size * 2, OpenCL.find_type(:cl_float).size * 2 )
329
+ # Creates a new Float2 with members set to 0 or to the user specified values. If a Pointer is passed as the first argument, Float2 maps the memory pointed.
573
330
  def initialize( s0 = 0.0, s1 = 0.0 )
574
- super()
575
- self[:s0] = s0
576
- self[:s1] = s1
331
+ if s0.is_a?(FFI::Pointer) then
332
+ super(s0)
333
+ else
334
+ super()
335
+ self[:s0] = s0
336
+ self[:s1] = s1
337
+ end
577
338
  end
578
339
  # Reads the s0 member
579
340
  def s0
@@ -601,14 +362,18 @@ module OpenCL
601
362
  end
602
363
  end
603
364
  # Maps the cl_double2 type of OpenCL
604
- class Double2 < FFI::Struct
605
- @size = FFI.find_type(:cl_double).size * 2
606
- @layout = FFI::StructLayout::new([ FFI::StructLayout::Field::new( "s0", FFI.find_type(:cl_double).size * 0, FFI.find_type(:cl_double) ), FFI::StructLayout::Field::new( "s1", FFI.find_type(:cl_double).size * 1, FFI.find_type(:cl_double) ) ], FFI.find_type(:cl_double).size * 2, FFI.find_type(:cl_double).size * 2 )
607
- # Creates a new Double2 with members set to 0 or to the user specified values
365
+ class Double2 < Struct
366
+ @size = OpenCL.find_type(:cl_double).size * 2
367
+ @layout = OpenCL::StructLayout::new([ OpenCL::StructLayout::Field::new( "s0", OpenCL.find_type(:cl_double).size * 0, OpenCL.find_type(:cl_double) ), OpenCL::StructLayout::Field::new( "s1", OpenCL.find_type(:cl_double).size * 1, OpenCL.find_type(:cl_double) ) ], OpenCL.find_type(:cl_double).size * 2, OpenCL.find_type(:cl_double).size * 2 )
368
+ # Creates a new Double2 with members set to 0 or to the user specified values. If a Pointer is passed as the first argument, Double2 maps the memory pointed.
608
369
  def initialize( s0 = 0.0, s1 = 0.0 )
609
- super()
610
- self[:s0] = s0
611
- self[:s1] = s1
370
+ if s0.is_a?(FFI::Pointer) then
371
+ super(s0)
372
+ else
373
+ super()
374
+ self[:s0] = s0
375
+ self[:s1] = s1
376
+ end
612
377
  end
613
378
  # Reads the s0 member
614
379
  def s0
@@ -636,14 +401,18 @@ module OpenCL
636
401
  end
637
402
  end
638
403
  # Maps the cl_half2 type of OpenCL
639
- class Half2 < FFI::Struct
640
- @size = FFI.find_type(:cl_half).size * 2
641
- @layout = FFI::StructLayout::new([ FFI::StructLayout::Field::new( "s0", FFI.find_type(:cl_half).size * 0, FFI.find_type(:cl_half) ), FFI::StructLayout::Field::new( "s1", FFI.find_type(:cl_half).size * 1, FFI.find_type(:cl_half) ) ], FFI.find_type(:cl_half).size * 2, FFI.find_type(:cl_half).size * 2 )
642
- # Creates a new Half2 with members set to 0 or to the user specified values
404
+ class Half2 < Struct
405
+ @size = OpenCL.find_type(:cl_half).size * 2
406
+ @layout = OpenCL::StructLayout::new([ OpenCL::StructLayout::Field::new( "s0", OpenCL.find_type(:cl_half).size * 0, OpenCL.find_type(:cl_half) ), OpenCL::StructLayout::Field::new( "s1", OpenCL.find_type(:cl_half).size * 1, OpenCL.find_type(:cl_half) ) ], OpenCL.find_type(:cl_half).size * 2, OpenCL.find_type(:cl_half).size * 2 )
407
+ # Creates a new Half2 with members set to 0 or to the user specified values. If a Pointer is passed as the first argument, Half2 maps the memory pointed.
643
408
  def initialize( s0 = 0.0, s1 = 0.0 )
644
- super()
645
- self[:s0] = s0
646
- self[:s1] = s1
409
+ if s0.is_a?(FFI::Pointer) then
410
+ super(s0)
411
+ else
412
+ super()
413
+ self[:s0] = s0
414
+ self[:s1] = s1
415
+ end
647
416
  end
648
417
  # Reads the s0 member
649
418
  def s0
@@ -671,16 +440,20 @@ module OpenCL
671
440
  end
672
441
  end
673
442
  # Maps the cl_char4 type of OpenCL
674
- class Char4 < FFI::Struct
675
- @size = FFI.find_type(:cl_char).size * 4
676
- @layout = FFI::StructLayout::new([ FFI::StructLayout::Field::new( "s0", FFI.find_type(:cl_char).size * 0, FFI.find_type(:cl_char) ), FFI::StructLayout::Field::new( "s1", FFI.find_type(:cl_char).size * 1, FFI.find_type(:cl_char) ), FFI::StructLayout::Field::new( "s2", FFI.find_type(:cl_char).size * 2, FFI.find_type(:cl_char) ), FFI::StructLayout::Field::new( "s3", FFI.find_type(:cl_char).size * 3, FFI.find_type(:cl_char) ) ], FFI.find_type(:cl_char).size * 4, FFI.find_type(:cl_char).size * 4 )
677
- # Creates a new Char4 with members set to 0 or to the user specified values
443
+ class Char4 < Struct
444
+ @size = OpenCL.find_type(:cl_char).size * 4
445
+ @layout = OpenCL::StructLayout::new([ OpenCL::StructLayout::Field::new( "s0", OpenCL.find_type(:cl_char).size * 0, OpenCL.find_type(:cl_char) ), OpenCL::StructLayout::Field::new( "s1", OpenCL.find_type(:cl_char).size * 1, OpenCL.find_type(:cl_char) ), OpenCL::StructLayout::Field::new( "s2", OpenCL.find_type(:cl_char).size * 2, OpenCL.find_type(:cl_char) ), OpenCL::StructLayout::Field::new( "s3", OpenCL.find_type(:cl_char).size * 3, OpenCL.find_type(:cl_char) ) ], OpenCL.find_type(:cl_char).size * 4, OpenCL.find_type(:cl_char).size * 4 )
446
+ # Creates a new Char4 with members set to 0 or to the user specified values. If a Pointer is passed as the first argument, Char4 maps the memory pointed.
678
447
  def initialize( s0 = 0, s1 = 0, s2 = 0, s3 = 0 )
679
- super()
680
- self[:s0] = s0
681
- self[:s1] = s1
682
- self[:s2] = s2
683
- self[:s3] = s3
448
+ if s0.is_a?(FFI::Pointer) then
449
+ super(s0)
450
+ else
451
+ super()
452
+ self[:s0] = s0
453
+ self[:s1] = s1
454
+ self[:s2] = s2
455
+ self[:s3] = s3
456
+ end
684
457
  end
685
458
  # Reads the s0 member
686
459
  def s0
@@ -724,16 +497,20 @@ module OpenCL
724
497
  end
725
498
  end
726
499
  # Maps the cl_uchar4 type of OpenCL
727
- class UChar4 < FFI::Struct
728
- @size = FFI.find_type(:cl_uchar).size * 4
729
- @layout = FFI::StructLayout::new([ FFI::StructLayout::Field::new( "s0", FFI.find_type(:cl_uchar).size * 0, FFI.find_type(:cl_uchar) ), FFI::StructLayout::Field::new( "s1", FFI.find_type(:cl_uchar).size * 1, FFI.find_type(:cl_uchar) ), FFI::StructLayout::Field::new( "s2", FFI.find_type(:cl_uchar).size * 2, FFI.find_type(:cl_uchar) ), FFI::StructLayout::Field::new( "s3", FFI.find_type(:cl_uchar).size * 3, FFI.find_type(:cl_uchar) ) ], FFI.find_type(:cl_uchar).size * 4, FFI.find_type(:cl_uchar).size * 4 )
730
- # Creates a new UChar4 with members set to 0 or to the user specified values
500
+ class UChar4 < Struct
501
+ @size = OpenCL.find_type(:cl_uchar).size * 4
502
+ @layout = OpenCL::StructLayout::new([ OpenCL::StructLayout::Field::new( "s0", OpenCL.find_type(:cl_uchar).size * 0, OpenCL.find_type(:cl_uchar) ), OpenCL::StructLayout::Field::new( "s1", OpenCL.find_type(:cl_uchar).size * 1, OpenCL.find_type(:cl_uchar) ), OpenCL::StructLayout::Field::new( "s2", OpenCL.find_type(:cl_uchar).size * 2, OpenCL.find_type(:cl_uchar) ), OpenCL::StructLayout::Field::new( "s3", OpenCL.find_type(:cl_uchar).size * 3, OpenCL.find_type(:cl_uchar) ) ], OpenCL.find_type(:cl_uchar).size * 4, OpenCL.find_type(:cl_uchar).size * 4 )
503
+ # Creates a new UChar4 with members set to 0 or to the user specified values. If a Pointer is passed as the first argument, UChar4 maps the memory pointed.
731
504
  def initialize( s0 = 0, s1 = 0, s2 = 0, s3 = 0 )
732
- super()
733
- self[:s0] = s0
734
- self[:s1] = s1
735
- self[:s2] = s2
736
- self[:s3] = s3
505
+ if s0.is_a?(FFI::Pointer) then
506
+ super(s0)
507
+ else
508
+ super()
509
+ self[:s0] = s0
510
+ self[:s1] = s1
511
+ self[:s2] = s2
512
+ self[:s3] = s3
513
+ end
737
514
  end
738
515
  # Reads the s0 member
739
516
  def s0
@@ -777,16 +554,20 @@ module OpenCL
777
554
  end
778
555
  end
779
556
  # Maps the cl_short4 type of OpenCL
780
- class Short4 < FFI::Struct
781
- @size = FFI.find_type(:cl_short).size * 4
782
- @layout = FFI::StructLayout::new([ FFI::StructLayout::Field::new( "s0", FFI.find_type(:cl_short).size * 0, FFI.find_type(:cl_short) ), FFI::StructLayout::Field::new( "s1", FFI.find_type(:cl_short).size * 1, FFI.find_type(:cl_short) ), FFI::StructLayout::Field::new( "s2", FFI.find_type(:cl_short).size * 2, FFI.find_type(:cl_short) ), FFI::StructLayout::Field::new( "s3", FFI.find_type(:cl_short).size * 3, FFI.find_type(:cl_short) ) ], FFI.find_type(:cl_short).size * 4, FFI.find_type(:cl_short).size * 4 )
783
- # Creates a new Short4 with members set to 0 or to the user specified values
557
+ class Short4 < Struct
558
+ @size = OpenCL.find_type(:cl_short).size * 4
559
+ @layout = OpenCL::StructLayout::new([ OpenCL::StructLayout::Field::new( "s0", OpenCL.find_type(:cl_short).size * 0, OpenCL.find_type(:cl_short) ), OpenCL::StructLayout::Field::new( "s1", OpenCL.find_type(:cl_short).size * 1, OpenCL.find_type(:cl_short) ), OpenCL::StructLayout::Field::new( "s2", OpenCL.find_type(:cl_short).size * 2, OpenCL.find_type(:cl_short) ), OpenCL::StructLayout::Field::new( "s3", OpenCL.find_type(:cl_short).size * 3, OpenCL.find_type(:cl_short) ) ], OpenCL.find_type(:cl_short).size * 4, OpenCL.find_type(:cl_short).size * 4 )
560
+ # Creates a new Short4 with members set to 0 or to the user specified values. If a Pointer is passed as the first argument, Short4 maps the memory pointed.
784
561
  def initialize( s0 = 0, s1 = 0, s2 = 0, s3 = 0 )
785
- super()
786
- self[:s0] = s0
787
- self[:s1] = s1
788
- self[:s2] = s2
789
- self[:s3] = s3
562
+ if s0.is_a?(FFI::Pointer) then
563
+ super(s0)
564
+ else
565
+ super()
566
+ self[:s0] = s0
567
+ self[:s1] = s1
568
+ self[:s2] = s2
569
+ self[:s3] = s3
570
+ end
790
571
  end
791
572
  # Reads the s0 member
792
573
  def s0
@@ -830,16 +611,20 @@ module OpenCL
830
611
  end
831
612
  end
832
613
  # Maps the cl_ushort4 type of OpenCL
833
- class UShort4 < FFI::Struct
834
- @size = FFI.find_type(:cl_ushort).size * 4
835
- @layout = FFI::StructLayout::new([ FFI::StructLayout::Field::new( "s0", FFI.find_type(:cl_ushort).size * 0, FFI.find_type(:cl_ushort) ), FFI::StructLayout::Field::new( "s1", FFI.find_type(:cl_ushort).size * 1, FFI.find_type(:cl_ushort) ), FFI::StructLayout::Field::new( "s2", FFI.find_type(:cl_ushort).size * 2, FFI.find_type(:cl_ushort) ), FFI::StructLayout::Field::new( "s3", FFI.find_type(:cl_ushort).size * 3, FFI.find_type(:cl_ushort) ) ], FFI.find_type(:cl_ushort).size * 4, FFI.find_type(:cl_ushort).size * 4 )
836
- # Creates a new UShort4 with members set to 0 or to the user specified values
614
+ class UShort4 < Struct
615
+ @size = OpenCL.find_type(:cl_ushort).size * 4
616
+ @layout = OpenCL::StructLayout::new([ OpenCL::StructLayout::Field::new( "s0", OpenCL.find_type(:cl_ushort).size * 0, OpenCL.find_type(:cl_ushort) ), OpenCL::StructLayout::Field::new( "s1", OpenCL.find_type(:cl_ushort).size * 1, OpenCL.find_type(:cl_ushort) ), OpenCL::StructLayout::Field::new( "s2", OpenCL.find_type(:cl_ushort).size * 2, OpenCL.find_type(:cl_ushort) ), OpenCL::StructLayout::Field::new( "s3", OpenCL.find_type(:cl_ushort).size * 3, OpenCL.find_type(:cl_ushort) ) ], OpenCL.find_type(:cl_ushort).size * 4, OpenCL.find_type(:cl_ushort).size * 4 )
617
+ # Creates a new UShort4 with members set to 0 or to the user specified values. If a Pointer is passed as the first argument, UShort4 maps the memory pointed.
837
618
  def initialize( s0 = 0, s1 = 0, s2 = 0, s3 = 0 )
838
- super()
839
- self[:s0] = s0
840
- self[:s1] = s1
841
- self[:s2] = s2
842
- self[:s3] = s3
619
+ if s0.is_a?(FFI::Pointer) then
620
+ super(s0)
621
+ else
622
+ super()
623
+ self[:s0] = s0
624
+ self[:s1] = s1
625
+ self[:s2] = s2
626
+ self[:s3] = s3
627
+ end
843
628
  end
844
629
  # Reads the s0 member
845
630
  def s0
@@ -883,16 +668,20 @@ module OpenCL
883
668
  end
884
669
  end
885
670
  # Maps the cl_int4 type of OpenCL
886
- class Int4 < FFI::Struct
887
- @size = FFI.find_type(:cl_int).size * 4
888
- @layout = FFI::StructLayout::new([ FFI::StructLayout::Field::new( "s0", FFI.find_type(:cl_int).size * 0, FFI.find_type(:cl_int) ), FFI::StructLayout::Field::new( "s1", FFI.find_type(:cl_int).size * 1, FFI.find_type(:cl_int) ), FFI::StructLayout::Field::new( "s2", FFI.find_type(:cl_int).size * 2, FFI.find_type(:cl_int) ), FFI::StructLayout::Field::new( "s3", FFI.find_type(:cl_int).size * 3, FFI.find_type(:cl_int) ) ], FFI.find_type(:cl_int).size * 4, FFI.find_type(:cl_int).size * 4 )
889
- # Creates a new Int4 with members set to 0 or to the user specified values
671
+ class Int4 < Struct
672
+ @size = OpenCL.find_type(:cl_int).size * 4
673
+ @layout = OpenCL::StructLayout::new([ OpenCL::StructLayout::Field::new( "s0", OpenCL.find_type(:cl_int).size * 0, OpenCL.find_type(:cl_int) ), OpenCL::StructLayout::Field::new( "s1", OpenCL.find_type(:cl_int).size * 1, OpenCL.find_type(:cl_int) ), OpenCL::StructLayout::Field::new( "s2", OpenCL.find_type(:cl_int).size * 2, OpenCL.find_type(:cl_int) ), OpenCL::StructLayout::Field::new( "s3", OpenCL.find_type(:cl_int).size * 3, OpenCL.find_type(:cl_int) ) ], OpenCL.find_type(:cl_int).size * 4, OpenCL.find_type(:cl_int).size * 4 )
674
+ # Creates a new Int4 with members set to 0 or to the user specified values. If a Pointer is passed as the first argument, Int4 maps the memory pointed.
890
675
  def initialize( s0 = 0, s1 = 0, s2 = 0, s3 = 0 )
891
- super()
892
- self[:s0] = s0
893
- self[:s1] = s1
894
- self[:s2] = s2
895
- self[:s3] = s3
676
+ if s0.is_a?(FFI::Pointer) then
677
+ super(s0)
678
+ else
679
+ super()
680
+ self[:s0] = s0
681
+ self[:s1] = s1
682
+ self[:s2] = s2
683
+ self[:s3] = s3
684
+ end
896
685
  end
897
686
  # Reads the s0 member
898
687
  def s0
@@ -936,16 +725,20 @@ module OpenCL
936
725
  end
937
726
  end
938
727
  # Maps the cl_uint4 type of OpenCL
939
- class UInt4 < FFI::Struct
940
- @size = FFI.find_type(:cl_uint).size * 4
941
- @layout = FFI::StructLayout::new([ FFI::StructLayout::Field::new( "s0", FFI.find_type(:cl_uint).size * 0, FFI.find_type(:cl_uint) ), FFI::StructLayout::Field::new( "s1", FFI.find_type(:cl_uint).size * 1, FFI.find_type(:cl_uint) ), FFI::StructLayout::Field::new( "s2", FFI.find_type(:cl_uint).size * 2, FFI.find_type(:cl_uint) ), FFI::StructLayout::Field::new( "s3", FFI.find_type(:cl_uint).size * 3, FFI.find_type(:cl_uint) ) ], FFI.find_type(:cl_uint).size * 4, FFI.find_type(:cl_uint).size * 4 )
942
- # Creates a new UInt4 with members set to 0 or to the user specified values
728
+ class UInt4 < Struct
729
+ @size = OpenCL.find_type(:cl_uint).size * 4
730
+ @layout = OpenCL::StructLayout::new([ OpenCL::StructLayout::Field::new( "s0", OpenCL.find_type(:cl_uint).size * 0, OpenCL.find_type(:cl_uint) ), OpenCL::StructLayout::Field::new( "s1", OpenCL.find_type(:cl_uint).size * 1, OpenCL.find_type(:cl_uint) ), OpenCL::StructLayout::Field::new( "s2", OpenCL.find_type(:cl_uint).size * 2, OpenCL.find_type(:cl_uint) ), OpenCL::StructLayout::Field::new( "s3", OpenCL.find_type(:cl_uint).size * 3, OpenCL.find_type(:cl_uint) ) ], OpenCL.find_type(:cl_uint).size * 4, OpenCL.find_type(:cl_uint).size * 4 )
731
+ # Creates a new UInt4 with members set to 0 or to the user specified values. If a Pointer is passed as the first argument, UInt4 maps the memory pointed.
943
732
  def initialize( s0 = 0, s1 = 0, s2 = 0, s3 = 0 )
944
- super()
945
- self[:s0] = s0
946
- self[:s1] = s1
947
- self[:s2] = s2
948
- self[:s3] = s3
733
+ if s0.is_a?(FFI::Pointer) then
734
+ super(s0)
735
+ else
736
+ super()
737
+ self[:s0] = s0
738
+ self[:s1] = s1
739
+ self[:s2] = s2
740
+ self[:s3] = s3
741
+ end
949
742
  end
950
743
  # Reads the s0 member
951
744
  def s0
@@ -989,16 +782,20 @@ module OpenCL
989
782
  end
990
783
  end
991
784
  # Maps the cl_long4 type of OpenCL
992
- class Long4 < FFI::Struct
993
- @size = FFI.find_type(:cl_long).size * 4
994
- @layout = FFI::StructLayout::new([ FFI::StructLayout::Field::new( "s0", FFI.find_type(:cl_long).size * 0, FFI.find_type(:cl_long) ), FFI::StructLayout::Field::new( "s1", FFI.find_type(:cl_long).size * 1, FFI.find_type(:cl_long) ), FFI::StructLayout::Field::new( "s2", FFI.find_type(:cl_long).size * 2, FFI.find_type(:cl_long) ), FFI::StructLayout::Field::new( "s3", FFI.find_type(:cl_long).size * 3, FFI.find_type(:cl_long) ) ], FFI.find_type(:cl_long).size * 4, FFI.find_type(:cl_long).size * 4 )
995
- # Creates a new Long4 with members set to 0 or to the user specified values
785
+ class Long4 < Struct
786
+ @size = OpenCL.find_type(:cl_long).size * 4
787
+ @layout = OpenCL::StructLayout::new([ OpenCL::StructLayout::Field::new( "s0", OpenCL.find_type(:cl_long).size * 0, OpenCL.find_type(:cl_long) ), OpenCL::StructLayout::Field::new( "s1", OpenCL.find_type(:cl_long).size * 1, OpenCL.find_type(:cl_long) ), OpenCL::StructLayout::Field::new( "s2", OpenCL.find_type(:cl_long).size * 2, OpenCL.find_type(:cl_long) ), OpenCL::StructLayout::Field::new( "s3", OpenCL.find_type(:cl_long).size * 3, OpenCL.find_type(:cl_long) ) ], OpenCL.find_type(:cl_long).size * 4, OpenCL.find_type(:cl_long).size * 4 )
788
+ # Creates a new Long4 with members set to 0 or to the user specified values. If a Pointer is passed as the first argument, Long4 maps the memory pointed.
996
789
  def initialize( s0 = 0, s1 = 0, s2 = 0, s3 = 0 )
997
- super()
998
- self[:s0] = s0
999
- self[:s1] = s1
1000
- self[:s2] = s2
1001
- self[:s3] = s3
790
+ if s0.is_a?(FFI::Pointer) then
791
+ super(s0)
792
+ else
793
+ super()
794
+ self[:s0] = s0
795
+ self[:s1] = s1
796
+ self[:s2] = s2
797
+ self[:s3] = s3
798
+ end
1002
799
  end
1003
800
  # Reads the s0 member
1004
801
  def s0
@@ -1042,16 +839,20 @@ module OpenCL
1042
839
  end
1043
840
  end
1044
841
  # Maps the cl_ulong4 type of OpenCL
1045
- class ULong4 < FFI::Struct
1046
- @size = FFI.find_type(:cl_ulong).size * 4
1047
- @layout = FFI::StructLayout::new([ FFI::StructLayout::Field::new( "s0", FFI.find_type(:cl_ulong).size * 0, FFI.find_type(:cl_ulong) ), FFI::StructLayout::Field::new( "s1", FFI.find_type(:cl_ulong).size * 1, FFI.find_type(:cl_ulong) ), FFI::StructLayout::Field::new( "s2", FFI.find_type(:cl_ulong).size * 2, FFI.find_type(:cl_ulong) ), FFI::StructLayout::Field::new( "s3", FFI.find_type(:cl_ulong).size * 3, FFI.find_type(:cl_ulong) ) ], FFI.find_type(:cl_ulong).size * 4, FFI.find_type(:cl_ulong).size * 4 )
1048
- # Creates a new ULong4 with members set to 0 or to the user specified values
842
+ class ULong4 < Struct
843
+ @size = OpenCL.find_type(:cl_ulong).size * 4
844
+ @layout = OpenCL::StructLayout::new([ OpenCL::StructLayout::Field::new( "s0", OpenCL.find_type(:cl_ulong).size * 0, OpenCL.find_type(:cl_ulong) ), OpenCL::StructLayout::Field::new( "s1", OpenCL.find_type(:cl_ulong).size * 1, OpenCL.find_type(:cl_ulong) ), OpenCL::StructLayout::Field::new( "s2", OpenCL.find_type(:cl_ulong).size * 2, OpenCL.find_type(:cl_ulong) ), OpenCL::StructLayout::Field::new( "s3", OpenCL.find_type(:cl_ulong).size * 3, OpenCL.find_type(:cl_ulong) ) ], OpenCL.find_type(:cl_ulong).size * 4, OpenCL.find_type(:cl_ulong).size * 4 )
845
+ # Creates a new ULong4 with members set to 0 or to the user specified values. If a Pointer is passed as the first argument, ULong4 maps the memory pointed.
1049
846
  def initialize( s0 = 0, s1 = 0, s2 = 0, s3 = 0 )
1050
- super()
1051
- self[:s0] = s0
1052
- self[:s1] = s1
1053
- self[:s2] = s2
1054
- self[:s3] = s3
847
+ if s0.is_a?(FFI::Pointer) then
848
+ super(s0)
849
+ else
850
+ super()
851
+ self[:s0] = s0
852
+ self[:s1] = s1
853
+ self[:s2] = s2
854
+ self[:s3] = s3
855
+ end
1055
856
  end
1056
857
  # Reads the s0 member
1057
858
  def s0
@@ -1095,16 +896,20 @@ module OpenCL
1095
896
  end
1096
897
  end
1097
898
  # Maps the cl_float4 type of OpenCL
1098
- class Float4 < FFI::Struct
1099
- @size = FFI.find_type(:cl_float).size * 4
1100
- @layout = FFI::StructLayout::new([ FFI::StructLayout::Field::new( "s0", FFI.find_type(:cl_float).size * 0, FFI.find_type(:cl_float) ), FFI::StructLayout::Field::new( "s1", FFI.find_type(:cl_float).size * 1, FFI.find_type(:cl_float) ), FFI::StructLayout::Field::new( "s2", FFI.find_type(:cl_float).size * 2, FFI.find_type(:cl_float) ), FFI::StructLayout::Field::new( "s3", FFI.find_type(:cl_float).size * 3, FFI.find_type(:cl_float) ) ], FFI.find_type(:cl_float).size * 4, FFI.find_type(:cl_float).size * 4 )
1101
- # Creates a new Float4 with members set to 0 or to the user specified values
899
+ class Float4 < Struct
900
+ @size = OpenCL.find_type(:cl_float).size * 4
901
+ @layout = OpenCL::StructLayout::new([ OpenCL::StructLayout::Field::new( "s0", OpenCL.find_type(:cl_float).size * 0, OpenCL.find_type(:cl_float) ), OpenCL::StructLayout::Field::new( "s1", OpenCL.find_type(:cl_float).size * 1, OpenCL.find_type(:cl_float) ), OpenCL::StructLayout::Field::new( "s2", OpenCL.find_type(:cl_float).size * 2, OpenCL.find_type(:cl_float) ), OpenCL::StructLayout::Field::new( "s3", OpenCL.find_type(:cl_float).size * 3, OpenCL.find_type(:cl_float) ) ], OpenCL.find_type(:cl_float).size * 4, OpenCL.find_type(:cl_float).size * 4 )
902
+ # Creates a new Float4 with members set to 0 or to the user specified values. If a Pointer is passed as the first argument, Float4 maps the memory pointed.
1102
903
  def initialize( s0 = 0.0, s1 = 0.0, s2 = 0.0, s3 = 0.0 )
1103
- super()
1104
- self[:s0] = s0
1105
- self[:s1] = s1
1106
- self[:s2] = s2
1107
- self[:s3] = s3
904
+ if s0.is_a?(FFI::Pointer) then
905
+ super(s0)
906
+ else
907
+ super()
908
+ self[:s0] = s0
909
+ self[:s1] = s1
910
+ self[:s2] = s2
911
+ self[:s3] = s3
912
+ end
1108
913
  end
1109
914
  # Reads the s0 member
1110
915
  def s0
@@ -1148,16 +953,20 @@ module OpenCL
1148
953
  end
1149
954
  end
1150
955
  # Maps the cl_double4 type of OpenCL
1151
- class Double4 < FFI::Struct
1152
- @size = FFI.find_type(:cl_double).size * 4
1153
- @layout = FFI::StructLayout::new([ FFI::StructLayout::Field::new( "s0", FFI.find_type(:cl_double).size * 0, FFI.find_type(:cl_double) ), FFI::StructLayout::Field::new( "s1", FFI.find_type(:cl_double).size * 1, FFI.find_type(:cl_double) ), FFI::StructLayout::Field::new( "s2", FFI.find_type(:cl_double).size * 2, FFI.find_type(:cl_double) ), FFI::StructLayout::Field::new( "s3", FFI.find_type(:cl_double).size * 3, FFI.find_type(:cl_double) ) ], FFI.find_type(:cl_double).size * 4, FFI.find_type(:cl_double).size * 4 )
1154
- # Creates a new Double4 with members set to 0 or to the user specified values
956
+ class Double4 < Struct
957
+ @size = OpenCL.find_type(:cl_double).size * 4
958
+ @layout = OpenCL::StructLayout::new([ OpenCL::StructLayout::Field::new( "s0", OpenCL.find_type(:cl_double).size * 0, OpenCL.find_type(:cl_double) ), OpenCL::StructLayout::Field::new( "s1", OpenCL.find_type(:cl_double).size * 1, OpenCL.find_type(:cl_double) ), OpenCL::StructLayout::Field::new( "s2", OpenCL.find_type(:cl_double).size * 2, OpenCL.find_type(:cl_double) ), OpenCL::StructLayout::Field::new( "s3", OpenCL.find_type(:cl_double).size * 3, OpenCL.find_type(:cl_double) ) ], OpenCL.find_type(:cl_double).size * 4, OpenCL.find_type(:cl_double).size * 4 )
959
+ # Creates a new Double4 with members set to 0 or to the user specified values. If a Pointer is passed as the first argument, Double4 maps the memory pointed.
1155
960
  def initialize( s0 = 0.0, s1 = 0.0, s2 = 0.0, s3 = 0.0 )
1156
- super()
1157
- self[:s0] = s0
1158
- self[:s1] = s1
1159
- self[:s2] = s2
1160
- self[:s3] = s3
961
+ if s0.is_a?(FFI::Pointer) then
962
+ super(s0)
963
+ else
964
+ super()
965
+ self[:s0] = s0
966
+ self[:s1] = s1
967
+ self[:s2] = s2
968
+ self[:s3] = s3
969
+ end
1161
970
  end
1162
971
  # Reads the s0 member
1163
972
  def s0
@@ -1201,16 +1010,20 @@ module OpenCL
1201
1010
  end
1202
1011
  end
1203
1012
  # Maps the cl_half4 type of OpenCL
1204
- class Half4 < FFI::Struct
1205
- @size = FFI.find_type(:cl_half).size * 4
1206
- @layout = FFI::StructLayout::new([ FFI::StructLayout::Field::new( "s0", FFI.find_type(:cl_half).size * 0, FFI.find_type(:cl_half) ), FFI::StructLayout::Field::new( "s1", FFI.find_type(:cl_half).size * 1, FFI.find_type(:cl_half) ), FFI::StructLayout::Field::new( "s2", FFI.find_type(:cl_half).size * 2, FFI.find_type(:cl_half) ), FFI::StructLayout::Field::new( "s3", FFI.find_type(:cl_half).size * 3, FFI.find_type(:cl_half) ) ], FFI.find_type(:cl_half).size * 4, FFI.find_type(:cl_half).size * 4 )
1207
- # Creates a new Half4 with members set to 0 or to the user specified values
1013
+ class Half4 < Struct
1014
+ @size = OpenCL.find_type(:cl_half).size * 4
1015
+ @layout = OpenCL::StructLayout::new([ OpenCL::StructLayout::Field::new( "s0", OpenCL.find_type(:cl_half).size * 0, OpenCL.find_type(:cl_half) ), OpenCL::StructLayout::Field::new( "s1", OpenCL.find_type(:cl_half).size * 1, OpenCL.find_type(:cl_half) ), OpenCL::StructLayout::Field::new( "s2", OpenCL.find_type(:cl_half).size * 2, OpenCL.find_type(:cl_half) ), OpenCL::StructLayout::Field::new( "s3", OpenCL.find_type(:cl_half).size * 3, OpenCL.find_type(:cl_half) ) ], OpenCL.find_type(:cl_half).size * 4, OpenCL.find_type(:cl_half).size * 4 )
1016
+ # Creates a new Half4 with members set to 0 or to the user specified values. If a Pointer is passed as the first argument, Half4 maps the memory pointed.
1208
1017
  def initialize( s0 = 0.0, s1 = 0.0, s2 = 0.0, s3 = 0.0 )
1209
- super()
1210
- self[:s0] = s0
1211
- self[:s1] = s1
1212
- self[:s2] = s2
1213
- self[:s3] = s3
1018
+ if s0.is_a?(FFI::Pointer) then
1019
+ super(s0)
1020
+ else
1021
+ super()
1022
+ self[:s0] = s0
1023
+ self[:s1] = s1
1024
+ self[:s2] = s2
1025
+ self[:s3] = s3
1026
+ end
1214
1027
  end
1215
1028
  # Reads the s0 member
1216
1029
  def s0
@@ -1254,20 +1067,24 @@ module OpenCL
1254
1067
  end
1255
1068
  end
1256
1069
  # Maps the cl_char8 type of OpenCL
1257
- class Char8 < FFI::Struct
1258
- @size = FFI.find_type(:cl_char).size * 8
1259
- @layout = FFI::StructLayout::new([ FFI::StructLayout::Field::new( "s0", FFI.find_type(:cl_char).size * 0, FFI.find_type(:cl_char) ), FFI::StructLayout::Field::new( "s1", FFI.find_type(:cl_char).size * 1, FFI.find_type(:cl_char) ), FFI::StructLayout::Field::new( "s2", FFI.find_type(:cl_char).size * 2, FFI.find_type(:cl_char) ), FFI::StructLayout::Field::new( "s3", FFI.find_type(:cl_char).size * 3, FFI.find_type(:cl_char) ), FFI::StructLayout::Field::new( "s4", FFI.find_type(:cl_char).size * 4, FFI.find_type(:cl_char) ), FFI::StructLayout::Field::new( "s5", FFI.find_type(:cl_char).size * 5, FFI.find_type(:cl_char) ), FFI::StructLayout::Field::new( "s6", FFI.find_type(:cl_char).size * 6, FFI.find_type(:cl_char) ), FFI::StructLayout::Field::new( "s7", FFI.find_type(:cl_char).size * 7, FFI.find_type(:cl_char) ) ], FFI.find_type(:cl_char).size * 8, FFI.find_type(:cl_char).size * 8 )
1260
- # Creates a new Char8 with members set to 0 or to the user specified values
1070
+ class Char8 < Struct
1071
+ @size = OpenCL.find_type(:cl_char).size * 8
1072
+ @layout = OpenCL::StructLayout::new([ OpenCL::StructLayout::Field::new( "s0", OpenCL.find_type(:cl_char).size * 0, OpenCL.find_type(:cl_char) ), OpenCL::StructLayout::Field::new( "s1", OpenCL.find_type(:cl_char).size * 1, OpenCL.find_type(:cl_char) ), OpenCL::StructLayout::Field::new( "s2", OpenCL.find_type(:cl_char).size * 2, OpenCL.find_type(:cl_char) ), OpenCL::StructLayout::Field::new( "s3", OpenCL.find_type(:cl_char).size * 3, OpenCL.find_type(:cl_char) ), OpenCL::StructLayout::Field::new( "s4", OpenCL.find_type(:cl_char).size * 4, OpenCL.find_type(:cl_char) ), OpenCL::StructLayout::Field::new( "s5", OpenCL.find_type(:cl_char).size * 5, OpenCL.find_type(:cl_char) ), OpenCL::StructLayout::Field::new( "s6", OpenCL.find_type(:cl_char).size * 6, OpenCL.find_type(:cl_char) ), OpenCL::StructLayout::Field::new( "s7", OpenCL.find_type(:cl_char).size * 7, OpenCL.find_type(:cl_char) ) ], OpenCL.find_type(:cl_char).size * 8, OpenCL.find_type(:cl_char).size * 8 )
1073
+ # Creates a new Char8 with members set to 0 or to the user specified values. If a Pointer is passed as the first argument, Char8 maps the memory pointed.
1261
1074
  def initialize( s0 = 0, s1 = 0, s2 = 0, s3 = 0, s4 = 0, s5 = 0, s6 = 0, s7 = 0 )
1262
- super()
1263
- self[:s0] = s0
1264
- self[:s1] = s1
1265
- self[:s2] = s2
1266
- self[:s3] = s3
1267
- self[:s4] = s4
1268
- self[:s5] = s5
1269
- self[:s6] = s6
1270
- self[:s7] = s7
1075
+ if s0.is_a?(FFI::Pointer) then
1076
+ super(s0)
1077
+ else
1078
+ super()
1079
+ self[:s0] = s0
1080
+ self[:s1] = s1
1081
+ self[:s2] = s2
1082
+ self[:s3] = s3
1083
+ self[:s4] = s4
1084
+ self[:s5] = s5
1085
+ self[:s6] = s6
1086
+ self[:s7] = s7
1087
+ end
1271
1088
  end
1272
1089
  # Reads the s0 member
1273
1090
  def s0
@@ -1343,20 +1160,24 @@ module OpenCL
1343
1160
  end
1344
1161
  end
1345
1162
  # Maps the cl_uchar8 type of OpenCL
1346
- class UChar8 < FFI::Struct
1347
- @size = FFI.find_type(:cl_uchar).size * 8
1348
- @layout = FFI::StructLayout::new([ FFI::StructLayout::Field::new( "s0", FFI.find_type(:cl_uchar).size * 0, FFI.find_type(:cl_uchar) ), FFI::StructLayout::Field::new( "s1", FFI.find_type(:cl_uchar).size * 1, FFI.find_type(:cl_uchar) ), FFI::StructLayout::Field::new( "s2", FFI.find_type(:cl_uchar).size * 2, FFI.find_type(:cl_uchar) ), FFI::StructLayout::Field::new( "s3", FFI.find_type(:cl_uchar).size * 3, FFI.find_type(:cl_uchar) ), FFI::StructLayout::Field::new( "s4", FFI.find_type(:cl_uchar).size * 4, FFI.find_type(:cl_uchar) ), FFI::StructLayout::Field::new( "s5", FFI.find_type(:cl_uchar).size * 5, FFI.find_type(:cl_uchar) ), FFI::StructLayout::Field::new( "s6", FFI.find_type(:cl_uchar).size * 6, FFI.find_type(:cl_uchar) ), FFI::StructLayout::Field::new( "s7", FFI.find_type(:cl_uchar).size * 7, FFI.find_type(:cl_uchar) ) ], FFI.find_type(:cl_uchar).size * 8, FFI.find_type(:cl_uchar).size * 8 )
1349
- # Creates a new UChar8 with members set to 0 or to the user specified values
1163
+ class UChar8 < Struct
1164
+ @size = OpenCL.find_type(:cl_uchar).size * 8
1165
+ @layout = OpenCL::StructLayout::new([ OpenCL::StructLayout::Field::new( "s0", OpenCL.find_type(:cl_uchar).size * 0, OpenCL.find_type(:cl_uchar) ), OpenCL::StructLayout::Field::new( "s1", OpenCL.find_type(:cl_uchar).size * 1, OpenCL.find_type(:cl_uchar) ), OpenCL::StructLayout::Field::new( "s2", OpenCL.find_type(:cl_uchar).size * 2, OpenCL.find_type(:cl_uchar) ), OpenCL::StructLayout::Field::new( "s3", OpenCL.find_type(:cl_uchar).size * 3, OpenCL.find_type(:cl_uchar) ), OpenCL::StructLayout::Field::new( "s4", OpenCL.find_type(:cl_uchar).size * 4, OpenCL.find_type(:cl_uchar) ), OpenCL::StructLayout::Field::new( "s5", OpenCL.find_type(:cl_uchar).size * 5, OpenCL.find_type(:cl_uchar) ), OpenCL::StructLayout::Field::new( "s6", OpenCL.find_type(:cl_uchar).size * 6, OpenCL.find_type(:cl_uchar) ), OpenCL::StructLayout::Field::new( "s7", OpenCL.find_type(:cl_uchar).size * 7, OpenCL.find_type(:cl_uchar) ) ], OpenCL.find_type(:cl_uchar).size * 8, OpenCL.find_type(:cl_uchar).size * 8 )
1166
+ # Creates a new UChar8 with members set to 0 or to the user specified values. If a Pointer is passed as the first argument, UChar8 maps the memory pointed.
1350
1167
  def initialize( s0 = 0, s1 = 0, s2 = 0, s3 = 0, s4 = 0, s5 = 0, s6 = 0, s7 = 0 )
1351
- super()
1352
- self[:s0] = s0
1353
- self[:s1] = s1
1354
- self[:s2] = s2
1355
- self[:s3] = s3
1356
- self[:s4] = s4
1357
- self[:s5] = s5
1358
- self[:s6] = s6
1359
- self[:s7] = s7
1168
+ if s0.is_a?(FFI::Pointer) then
1169
+ super(s0)
1170
+ else
1171
+ super()
1172
+ self[:s0] = s0
1173
+ self[:s1] = s1
1174
+ self[:s2] = s2
1175
+ self[:s3] = s3
1176
+ self[:s4] = s4
1177
+ self[:s5] = s5
1178
+ self[:s6] = s6
1179
+ self[:s7] = s7
1180
+ end
1360
1181
  end
1361
1182
  # Reads the s0 member
1362
1183
  def s0
@@ -1432,20 +1253,24 @@ module OpenCL
1432
1253
  end
1433
1254
  end
1434
1255
  # Maps the cl_short8 type of OpenCL
1435
- class Short8 < FFI::Struct
1436
- @size = FFI.find_type(:cl_short).size * 8
1437
- @layout = FFI::StructLayout::new([ FFI::StructLayout::Field::new( "s0", FFI.find_type(:cl_short).size * 0, FFI.find_type(:cl_short) ), FFI::StructLayout::Field::new( "s1", FFI.find_type(:cl_short).size * 1, FFI.find_type(:cl_short) ), FFI::StructLayout::Field::new( "s2", FFI.find_type(:cl_short).size * 2, FFI.find_type(:cl_short) ), FFI::StructLayout::Field::new( "s3", FFI.find_type(:cl_short).size * 3, FFI.find_type(:cl_short) ), FFI::StructLayout::Field::new( "s4", FFI.find_type(:cl_short).size * 4, FFI.find_type(:cl_short) ), FFI::StructLayout::Field::new( "s5", FFI.find_type(:cl_short).size * 5, FFI.find_type(:cl_short) ), FFI::StructLayout::Field::new( "s6", FFI.find_type(:cl_short).size * 6, FFI.find_type(:cl_short) ), FFI::StructLayout::Field::new( "s7", FFI.find_type(:cl_short).size * 7, FFI.find_type(:cl_short) ) ], FFI.find_type(:cl_short).size * 8, FFI.find_type(:cl_short).size * 8 )
1438
- # Creates a new Short8 with members set to 0 or to the user specified values
1256
+ class Short8 < Struct
1257
+ @size = OpenCL.find_type(:cl_short).size * 8
1258
+ @layout = OpenCL::StructLayout::new([ OpenCL::StructLayout::Field::new( "s0", OpenCL.find_type(:cl_short).size * 0, OpenCL.find_type(:cl_short) ), OpenCL::StructLayout::Field::new( "s1", OpenCL.find_type(:cl_short).size * 1, OpenCL.find_type(:cl_short) ), OpenCL::StructLayout::Field::new( "s2", OpenCL.find_type(:cl_short).size * 2, OpenCL.find_type(:cl_short) ), OpenCL::StructLayout::Field::new( "s3", OpenCL.find_type(:cl_short).size * 3, OpenCL.find_type(:cl_short) ), OpenCL::StructLayout::Field::new( "s4", OpenCL.find_type(:cl_short).size * 4, OpenCL.find_type(:cl_short) ), OpenCL::StructLayout::Field::new( "s5", OpenCL.find_type(:cl_short).size * 5, OpenCL.find_type(:cl_short) ), OpenCL::StructLayout::Field::new( "s6", OpenCL.find_type(:cl_short).size * 6, OpenCL.find_type(:cl_short) ), OpenCL::StructLayout::Field::new( "s7", OpenCL.find_type(:cl_short).size * 7, OpenCL.find_type(:cl_short) ) ], OpenCL.find_type(:cl_short).size * 8, OpenCL.find_type(:cl_short).size * 8 )
1259
+ # Creates a new Short8 with members set to 0 or to the user specified values. If a Pointer is passed as the first argument, Short8 maps the memory pointed.
1439
1260
  def initialize( s0 = 0, s1 = 0, s2 = 0, s3 = 0, s4 = 0, s5 = 0, s6 = 0, s7 = 0 )
1440
- super()
1441
- self[:s0] = s0
1442
- self[:s1] = s1
1443
- self[:s2] = s2
1444
- self[:s3] = s3
1445
- self[:s4] = s4
1446
- self[:s5] = s5
1447
- self[:s6] = s6
1448
- self[:s7] = s7
1261
+ if s0.is_a?(FFI::Pointer) then
1262
+ super(s0)
1263
+ else
1264
+ super()
1265
+ self[:s0] = s0
1266
+ self[:s1] = s1
1267
+ self[:s2] = s2
1268
+ self[:s3] = s3
1269
+ self[:s4] = s4
1270
+ self[:s5] = s5
1271
+ self[:s6] = s6
1272
+ self[:s7] = s7
1273
+ end
1449
1274
  end
1450
1275
  # Reads the s0 member
1451
1276
  def s0
@@ -1521,20 +1346,24 @@ module OpenCL
1521
1346
  end
1522
1347
  end
1523
1348
  # Maps the cl_ushort8 type of OpenCL
1524
- class UShort8 < FFI::Struct
1525
- @size = FFI.find_type(:cl_ushort).size * 8
1526
- @layout = FFI::StructLayout::new([ FFI::StructLayout::Field::new( "s0", FFI.find_type(:cl_ushort).size * 0, FFI.find_type(:cl_ushort) ), FFI::StructLayout::Field::new( "s1", FFI.find_type(:cl_ushort).size * 1, FFI.find_type(:cl_ushort) ), FFI::StructLayout::Field::new( "s2", FFI.find_type(:cl_ushort).size * 2, FFI.find_type(:cl_ushort) ), FFI::StructLayout::Field::new( "s3", FFI.find_type(:cl_ushort).size * 3, FFI.find_type(:cl_ushort) ), FFI::StructLayout::Field::new( "s4", FFI.find_type(:cl_ushort).size * 4, FFI.find_type(:cl_ushort) ), FFI::StructLayout::Field::new( "s5", FFI.find_type(:cl_ushort).size * 5, FFI.find_type(:cl_ushort) ), FFI::StructLayout::Field::new( "s6", FFI.find_type(:cl_ushort).size * 6, FFI.find_type(:cl_ushort) ), FFI::StructLayout::Field::new( "s7", FFI.find_type(:cl_ushort).size * 7, FFI.find_type(:cl_ushort) ) ], FFI.find_type(:cl_ushort).size * 8, FFI.find_type(:cl_ushort).size * 8 )
1527
- # Creates a new UShort8 with members set to 0 or to the user specified values
1349
+ class UShort8 < Struct
1350
+ @size = OpenCL.find_type(:cl_ushort).size * 8
1351
+ @layout = OpenCL::StructLayout::new([ OpenCL::StructLayout::Field::new( "s0", OpenCL.find_type(:cl_ushort).size * 0, OpenCL.find_type(:cl_ushort) ), OpenCL::StructLayout::Field::new( "s1", OpenCL.find_type(:cl_ushort).size * 1, OpenCL.find_type(:cl_ushort) ), OpenCL::StructLayout::Field::new( "s2", OpenCL.find_type(:cl_ushort).size * 2, OpenCL.find_type(:cl_ushort) ), OpenCL::StructLayout::Field::new( "s3", OpenCL.find_type(:cl_ushort).size * 3, OpenCL.find_type(:cl_ushort) ), OpenCL::StructLayout::Field::new( "s4", OpenCL.find_type(:cl_ushort).size * 4, OpenCL.find_type(:cl_ushort) ), OpenCL::StructLayout::Field::new( "s5", OpenCL.find_type(:cl_ushort).size * 5, OpenCL.find_type(:cl_ushort) ), OpenCL::StructLayout::Field::new( "s6", OpenCL.find_type(:cl_ushort).size * 6, OpenCL.find_type(:cl_ushort) ), OpenCL::StructLayout::Field::new( "s7", OpenCL.find_type(:cl_ushort).size * 7, OpenCL.find_type(:cl_ushort) ) ], OpenCL.find_type(:cl_ushort).size * 8, OpenCL.find_type(:cl_ushort).size * 8 )
1352
+ # Creates a new UShort8 with members set to 0 or to the user specified values. If a Pointer is passed as the first argument, UShort8 maps the memory pointed.
1528
1353
  def initialize( s0 = 0, s1 = 0, s2 = 0, s3 = 0, s4 = 0, s5 = 0, s6 = 0, s7 = 0 )
1529
- super()
1530
- self[:s0] = s0
1531
- self[:s1] = s1
1532
- self[:s2] = s2
1533
- self[:s3] = s3
1534
- self[:s4] = s4
1535
- self[:s5] = s5
1536
- self[:s6] = s6
1537
- self[:s7] = s7
1354
+ if s0.is_a?(FFI::Pointer) then
1355
+ super(s0)
1356
+ else
1357
+ super()
1358
+ self[:s0] = s0
1359
+ self[:s1] = s1
1360
+ self[:s2] = s2
1361
+ self[:s3] = s3
1362
+ self[:s4] = s4
1363
+ self[:s5] = s5
1364
+ self[:s6] = s6
1365
+ self[:s7] = s7
1366
+ end
1538
1367
  end
1539
1368
  # Reads the s0 member
1540
1369
  def s0
@@ -1610,20 +1439,24 @@ module OpenCL
1610
1439
  end
1611
1440
  end
1612
1441
  # Maps the cl_int8 type of OpenCL
1613
- class Int8 < FFI::Struct
1614
- @size = FFI.find_type(:cl_int).size * 8
1615
- @layout = FFI::StructLayout::new([ FFI::StructLayout::Field::new( "s0", FFI.find_type(:cl_int).size * 0, FFI.find_type(:cl_int) ), FFI::StructLayout::Field::new( "s1", FFI.find_type(:cl_int).size * 1, FFI.find_type(:cl_int) ), FFI::StructLayout::Field::new( "s2", FFI.find_type(:cl_int).size * 2, FFI.find_type(:cl_int) ), FFI::StructLayout::Field::new( "s3", FFI.find_type(:cl_int).size * 3, FFI.find_type(:cl_int) ), FFI::StructLayout::Field::new( "s4", FFI.find_type(:cl_int).size * 4, FFI.find_type(:cl_int) ), FFI::StructLayout::Field::new( "s5", FFI.find_type(:cl_int).size * 5, FFI.find_type(:cl_int) ), FFI::StructLayout::Field::new( "s6", FFI.find_type(:cl_int).size * 6, FFI.find_type(:cl_int) ), FFI::StructLayout::Field::new( "s7", FFI.find_type(:cl_int).size * 7, FFI.find_type(:cl_int) ) ], FFI.find_type(:cl_int).size * 8, FFI.find_type(:cl_int).size * 8 )
1616
- # Creates a new Int8 with members set to 0 or to the user specified values
1442
+ class Int8 < Struct
1443
+ @size = OpenCL.find_type(:cl_int).size * 8
1444
+ @layout = OpenCL::StructLayout::new([ OpenCL::StructLayout::Field::new( "s0", OpenCL.find_type(:cl_int).size * 0, OpenCL.find_type(:cl_int) ), OpenCL::StructLayout::Field::new( "s1", OpenCL.find_type(:cl_int).size * 1, OpenCL.find_type(:cl_int) ), OpenCL::StructLayout::Field::new( "s2", OpenCL.find_type(:cl_int).size * 2, OpenCL.find_type(:cl_int) ), OpenCL::StructLayout::Field::new( "s3", OpenCL.find_type(:cl_int).size * 3, OpenCL.find_type(:cl_int) ), OpenCL::StructLayout::Field::new( "s4", OpenCL.find_type(:cl_int).size * 4, OpenCL.find_type(:cl_int) ), OpenCL::StructLayout::Field::new( "s5", OpenCL.find_type(:cl_int).size * 5, OpenCL.find_type(:cl_int) ), OpenCL::StructLayout::Field::new( "s6", OpenCL.find_type(:cl_int).size * 6, OpenCL.find_type(:cl_int) ), OpenCL::StructLayout::Field::new( "s7", OpenCL.find_type(:cl_int).size * 7, OpenCL.find_type(:cl_int) ) ], OpenCL.find_type(:cl_int).size * 8, OpenCL.find_type(:cl_int).size * 8 )
1445
+ # Creates a new Int8 with members set to 0 or to the user specified values. If a Pointer is passed as the first argument, Int8 maps the memory pointed.
1617
1446
  def initialize( s0 = 0, s1 = 0, s2 = 0, s3 = 0, s4 = 0, s5 = 0, s6 = 0, s7 = 0 )
1618
- super()
1619
- self[:s0] = s0
1620
- self[:s1] = s1
1621
- self[:s2] = s2
1622
- self[:s3] = s3
1623
- self[:s4] = s4
1624
- self[:s5] = s5
1625
- self[:s6] = s6
1626
- self[:s7] = s7
1447
+ if s0.is_a?(FFI::Pointer) then
1448
+ super(s0)
1449
+ else
1450
+ super()
1451
+ self[:s0] = s0
1452
+ self[:s1] = s1
1453
+ self[:s2] = s2
1454
+ self[:s3] = s3
1455
+ self[:s4] = s4
1456
+ self[:s5] = s5
1457
+ self[:s6] = s6
1458
+ self[:s7] = s7
1459
+ end
1627
1460
  end
1628
1461
  # Reads the s0 member
1629
1462
  def s0
@@ -1699,20 +1532,24 @@ module OpenCL
1699
1532
  end
1700
1533
  end
1701
1534
  # Maps the cl_uint8 type of OpenCL
1702
- class UInt8 < FFI::Struct
1703
- @size = FFI.find_type(:cl_uint).size * 8
1704
- @layout = FFI::StructLayout::new([ FFI::StructLayout::Field::new( "s0", FFI.find_type(:cl_uint).size * 0, FFI.find_type(:cl_uint) ), FFI::StructLayout::Field::new( "s1", FFI.find_type(:cl_uint).size * 1, FFI.find_type(:cl_uint) ), FFI::StructLayout::Field::new( "s2", FFI.find_type(:cl_uint).size * 2, FFI.find_type(:cl_uint) ), FFI::StructLayout::Field::new( "s3", FFI.find_type(:cl_uint).size * 3, FFI.find_type(:cl_uint) ), FFI::StructLayout::Field::new( "s4", FFI.find_type(:cl_uint).size * 4, FFI.find_type(:cl_uint) ), FFI::StructLayout::Field::new( "s5", FFI.find_type(:cl_uint).size * 5, FFI.find_type(:cl_uint) ), FFI::StructLayout::Field::new( "s6", FFI.find_type(:cl_uint).size * 6, FFI.find_type(:cl_uint) ), FFI::StructLayout::Field::new( "s7", FFI.find_type(:cl_uint).size * 7, FFI.find_type(:cl_uint) ) ], FFI.find_type(:cl_uint).size * 8, FFI.find_type(:cl_uint).size * 8 )
1705
- # Creates a new UInt8 with members set to 0 or to the user specified values
1535
+ class UInt8 < Struct
1536
+ @size = OpenCL.find_type(:cl_uint).size * 8
1537
+ @layout = OpenCL::StructLayout::new([ OpenCL::StructLayout::Field::new( "s0", OpenCL.find_type(:cl_uint).size * 0, OpenCL.find_type(:cl_uint) ), OpenCL::StructLayout::Field::new( "s1", OpenCL.find_type(:cl_uint).size * 1, OpenCL.find_type(:cl_uint) ), OpenCL::StructLayout::Field::new( "s2", OpenCL.find_type(:cl_uint).size * 2, OpenCL.find_type(:cl_uint) ), OpenCL::StructLayout::Field::new( "s3", OpenCL.find_type(:cl_uint).size * 3, OpenCL.find_type(:cl_uint) ), OpenCL::StructLayout::Field::new( "s4", OpenCL.find_type(:cl_uint).size * 4, OpenCL.find_type(:cl_uint) ), OpenCL::StructLayout::Field::new( "s5", OpenCL.find_type(:cl_uint).size * 5, OpenCL.find_type(:cl_uint) ), OpenCL::StructLayout::Field::new( "s6", OpenCL.find_type(:cl_uint).size * 6, OpenCL.find_type(:cl_uint) ), OpenCL::StructLayout::Field::new( "s7", OpenCL.find_type(:cl_uint).size * 7, OpenCL.find_type(:cl_uint) ) ], OpenCL.find_type(:cl_uint).size * 8, OpenCL.find_type(:cl_uint).size * 8 )
1538
+ # Creates a new UInt8 with members set to 0 or to the user specified values. If a Pointer is passed as the first argument, UInt8 maps the memory pointed.
1706
1539
  def initialize( s0 = 0, s1 = 0, s2 = 0, s3 = 0, s4 = 0, s5 = 0, s6 = 0, s7 = 0 )
1707
- super()
1708
- self[:s0] = s0
1709
- self[:s1] = s1
1710
- self[:s2] = s2
1711
- self[:s3] = s3
1712
- self[:s4] = s4
1713
- self[:s5] = s5
1714
- self[:s6] = s6
1715
- self[:s7] = s7
1540
+ if s0.is_a?(FFI::Pointer) then
1541
+ super(s0)
1542
+ else
1543
+ super()
1544
+ self[:s0] = s0
1545
+ self[:s1] = s1
1546
+ self[:s2] = s2
1547
+ self[:s3] = s3
1548
+ self[:s4] = s4
1549
+ self[:s5] = s5
1550
+ self[:s6] = s6
1551
+ self[:s7] = s7
1552
+ end
1716
1553
  end
1717
1554
  # Reads the s0 member
1718
1555
  def s0
@@ -1788,20 +1625,24 @@ module OpenCL
1788
1625
  end
1789
1626
  end
1790
1627
  # Maps the cl_long8 type of OpenCL
1791
- class Long8 < FFI::Struct
1792
- @size = FFI.find_type(:cl_long).size * 8
1793
- @layout = FFI::StructLayout::new([ FFI::StructLayout::Field::new( "s0", FFI.find_type(:cl_long).size * 0, FFI.find_type(:cl_long) ), FFI::StructLayout::Field::new( "s1", FFI.find_type(:cl_long).size * 1, FFI.find_type(:cl_long) ), FFI::StructLayout::Field::new( "s2", FFI.find_type(:cl_long).size * 2, FFI.find_type(:cl_long) ), FFI::StructLayout::Field::new( "s3", FFI.find_type(:cl_long).size * 3, FFI.find_type(:cl_long) ), FFI::StructLayout::Field::new( "s4", FFI.find_type(:cl_long).size * 4, FFI.find_type(:cl_long) ), FFI::StructLayout::Field::new( "s5", FFI.find_type(:cl_long).size * 5, FFI.find_type(:cl_long) ), FFI::StructLayout::Field::new( "s6", FFI.find_type(:cl_long).size * 6, FFI.find_type(:cl_long) ), FFI::StructLayout::Field::new( "s7", FFI.find_type(:cl_long).size * 7, FFI.find_type(:cl_long) ) ], FFI.find_type(:cl_long).size * 8, FFI.find_type(:cl_long).size * 8 )
1794
- # Creates a new Long8 with members set to 0 or to the user specified values
1628
+ class Long8 < Struct
1629
+ @size = OpenCL.find_type(:cl_long).size * 8
1630
+ @layout = OpenCL::StructLayout::new([ OpenCL::StructLayout::Field::new( "s0", OpenCL.find_type(:cl_long).size * 0, OpenCL.find_type(:cl_long) ), OpenCL::StructLayout::Field::new( "s1", OpenCL.find_type(:cl_long).size * 1, OpenCL.find_type(:cl_long) ), OpenCL::StructLayout::Field::new( "s2", OpenCL.find_type(:cl_long).size * 2, OpenCL.find_type(:cl_long) ), OpenCL::StructLayout::Field::new( "s3", OpenCL.find_type(:cl_long).size * 3, OpenCL.find_type(:cl_long) ), OpenCL::StructLayout::Field::new( "s4", OpenCL.find_type(:cl_long).size * 4, OpenCL.find_type(:cl_long) ), OpenCL::StructLayout::Field::new( "s5", OpenCL.find_type(:cl_long).size * 5, OpenCL.find_type(:cl_long) ), OpenCL::StructLayout::Field::new( "s6", OpenCL.find_type(:cl_long).size * 6, OpenCL.find_type(:cl_long) ), OpenCL::StructLayout::Field::new( "s7", OpenCL.find_type(:cl_long).size * 7, OpenCL.find_type(:cl_long) ) ], OpenCL.find_type(:cl_long).size * 8, OpenCL.find_type(:cl_long).size * 8 )
1631
+ # Creates a new Long8 with members set to 0 or to the user specified values. If a Pointer is passed as the first argument, Long8 maps the memory pointed.
1795
1632
  def initialize( s0 = 0, s1 = 0, s2 = 0, s3 = 0, s4 = 0, s5 = 0, s6 = 0, s7 = 0 )
1796
- super()
1797
- self[:s0] = s0
1798
- self[:s1] = s1
1799
- self[:s2] = s2
1800
- self[:s3] = s3
1801
- self[:s4] = s4
1802
- self[:s5] = s5
1803
- self[:s6] = s6
1804
- self[:s7] = s7
1633
+ if s0.is_a?(FFI::Pointer) then
1634
+ super(s0)
1635
+ else
1636
+ super()
1637
+ self[:s0] = s0
1638
+ self[:s1] = s1
1639
+ self[:s2] = s2
1640
+ self[:s3] = s3
1641
+ self[:s4] = s4
1642
+ self[:s5] = s5
1643
+ self[:s6] = s6
1644
+ self[:s7] = s7
1645
+ end
1805
1646
  end
1806
1647
  # Reads the s0 member
1807
1648
  def s0
@@ -1877,20 +1718,24 @@ module OpenCL
1877
1718
  end
1878
1719
  end
1879
1720
  # Maps the cl_ulong8 type of OpenCL
1880
- class ULong8 < FFI::Struct
1881
- @size = FFI.find_type(:cl_ulong).size * 8
1882
- @layout = FFI::StructLayout::new([ FFI::StructLayout::Field::new( "s0", FFI.find_type(:cl_ulong).size * 0, FFI.find_type(:cl_ulong) ), FFI::StructLayout::Field::new( "s1", FFI.find_type(:cl_ulong).size * 1, FFI.find_type(:cl_ulong) ), FFI::StructLayout::Field::new( "s2", FFI.find_type(:cl_ulong).size * 2, FFI.find_type(:cl_ulong) ), FFI::StructLayout::Field::new( "s3", FFI.find_type(:cl_ulong).size * 3, FFI.find_type(:cl_ulong) ), FFI::StructLayout::Field::new( "s4", FFI.find_type(:cl_ulong).size * 4, FFI.find_type(:cl_ulong) ), FFI::StructLayout::Field::new( "s5", FFI.find_type(:cl_ulong).size * 5, FFI.find_type(:cl_ulong) ), FFI::StructLayout::Field::new( "s6", FFI.find_type(:cl_ulong).size * 6, FFI.find_type(:cl_ulong) ), FFI::StructLayout::Field::new( "s7", FFI.find_type(:cl_ulong).size * 7, FFI.find_type(:cl_ulong) ) ], FFI.find_type(:cl_ulong).size * 8, FFI.find_type(:cl_ulong).size * 8 )
1883
- # Creates a new ULong8 with members set to 0 or to the user specified values
1721
+ class ULong8 < Struct
1722
+ @size = OpenCL.find_type(:cl_ulong).size * 8
1723
+ @layout = OpenCL::StructLayout::new([ OpenCL::StructLayout::Field::new( "s0", OpenCL.find_type(:cl_ulong).size * 0, OpenCL.find_type(:cl_ulong) ), OpenCL::StructLayout::Field::new( "s1", OpenCL.find_type(:cl_ulong).size * 1, OpenCL.find_type(:cl_ulong) ), OpenCL::StructLayout::Field::new( "s2", OpenCL.find_type(:cl_ulong).size * 2, OpenCL.find_type(:cl_ulong) ), OpenCL::StructLayout::Field::new( "s3", OpenCL.find_type(:cl_ulong).size * 3, OpenCL.find_type(:cl_ulong) ), OpenCL::StructLayout::Field::new( "s4", OpenCL.find_type(:cl_ulong).size * 4, OpenCL.find_type(:cl_ulong) ), OpenCL::StructLayout::Field::new( "s5", OpenCL.find_type(:cl_ulong).size * 5, OpenCL.find_type(:cl_ulong) ), OpenCL::StructLayout::Field::new( "s6", OpenCL.find_type(:cl_ulong).size * 6, OpenCL.find_type(:cl_ulong) ), OpenCL::StructLayout::Field::new( "s7", OpenCL.find_type(:cl_ulong).size * 7, OpenCL.find_type(:cl_ulong) ) ], OpenCL.find_type(:cl_ulong).size * 8, OpenCL.find_type(:cl_ulong).size * 8 )
1724
+ # Creates a new ULong8 with members set to 0 or to the user specified values. If a Pointer is passed as the first argument, ULong8 maps the memory pointed.
1884
1725
  def initialize( s0 = 0, s1 = 0, s2 = 0, s3 = 0, s4 = 0, s5 = 0, s6 = 0, s7 = 0 )
1885
- super()
1886
- self[:s0] = s0
1887
- self[:s1] = s1
1888
- self[:s2] = s2
1889
- self[:s3] = s3
1890
- self[:s4] = s4
1891
- self[:s5] = s5
1892
- self[:s6] = s6
1893
- self[:s7] = s7
1726
+ if s0.is_a?(FFI::Pointer) then
1727
+ super(s0)
1728
+ else
1729
+ super()
1730
+ self[:s0] = s0
1731
+ self[:s1] = s1
1732
+ self[:s2] = s2
1733
+ self[:s3] = s3
1734
+ self[:s4] = s4
1735
+ self[:s5] = s5
1736
+ self[:s6] = s6
1737
+ self[:s7] = s7
1738
+ end
1894
1739
  end
1895
1740
  # Reads the s0 member
1896
1741
  def s0
@@ -1966,20 +1811,24 @@ module OpenCL
1966
1811
  end
1967
1812
  end
1968
1813
  # Maps the cl_float8 type of OpenCL
1969
- class Float8 < FFI::Struct
1970
- @size = FFI.find_type(:cl_float).size * 8
1971
- @layout = FFI::StructLayout::new([ FFI::StructLayout::Field::new( "s0", FFI.find_type(:cl_float).size * 0, FFI.find_type(:cl_float) ), FFI::StructLayout::Field::new( "s1", FFI.find_type(:cl_float).size * 1, FFI.find_type(:cl_float) ), FFI::StructLayout::Field::new( "s2", FFI.find_type(:cl_float).size * 2, FFI.find_type(:cl_float) ), FFI::StructLayout::Field::new( "s3", FFI.find_type(:cl_float).size * 3, FFI.find_type(:cl_float) ), FFI::StructLayout::Field::new( "s4", FFI.find_type(:cl_float).size * 4, FFI.find_type(:cl_float) ), FFI::StructLayout::Field::new( "s5", FFI.find_type(:cl_float).size * 5, FFI.find_type(:cl_float) ), FFI::StructLayout::Field::new( "s6", FFI.find_type(:cl_float).size * 6, FFI.find_type(:cl_float) ), FFI::StructLayout::Field::new( "s7", FFI.find_type(:cl_float).size * 7, FFI.find_type(:cl_float) ) ], FFI.find_type(:cl_float).size * 8, FFI.find_type(:cl_float).size * 8 )
1972
- # Creates a new Float8 with members set to 0 or to the user specified values
1814
+ class Float8 < Struct
1815
+ @size = OpenCL.find_type(:cl_float).size * 8
1816
+ @layout = OpenCL::StructLayout::new([ OpenCL::StructLayout::Field::new( "s0", OpenCL.find_type(:cl_float).size * 0, OpenCL.find_type(:cl_float) ), OpenCL::StructLayout::Field::new( "s1", OpenCL.find_type(:cl_float).size * 1, OpenCL.find_type(:cl_float) ), OpenCL::StructLayout::Field::new( "s2", OpenCL.find_type(:cl_float).size * 2, OpenCL.find_type(:cl_float) ), OpenCL::StructLayout::Field::new( "s3", OpenCL.find_type(:cl_float).size * 3, OpenCL.find_type(:cl_float) ), OpenCL::StructLayout::Field::new( "s4", OpenCL.find_type(:cl_float).size * 4, OpenCL.find_type(:cl_float) ), OpenCL::StructLayout::Field::new( "s5", OpenCL.find_type(:cl_float).size * 5, OpenCL.find_type(:cl_float) ), OpenCL::StructLayout::Field::new( "s6", OpenCL.find_type(:cl_float).size * 6, OpenCL.find_type(:cl_float) ), OpenCL::StructLayout::Field::new( "s7", OpenCL.find_type(:cl_float).size * 7, OpenCL.find_type(:cl_float) ) ], OpenCL.find_type(:cl_float).size * 8, OpenCL.find_type(:cl_float).size * 8 )
1817
+ # Creates a new Float8 with members set to 0 or to the user specified values. If a Pointer is passed as the first argument, Float8 maps the memory pointed.
1973
1818
  def initialize( s0 = 0.0, s1 = 0.0, s2 = 0.0, s3 = 0.0, s4 = 0.0, s5 = 0.0, s6 = 0.0, s7 = 0.0 )
1974
- super()
1975
- self[:s0] = s0
1976
- self[:s1] = s1
1977
- self[:s2] = s2
1978
- self[:s3] = s3
1979
- self[:s4] = s4
1980
- self[:s5] = s5
1981
- self[:s6] = s6
1982
- self[:s7] = s7
1819
+ if s0.is_a?(FFI::Pointer) then
1820
+ super(s0)
1821
+ else
1822
+ super()
1823
+ self[:s0] = s0
1824
+ self[:s1] = s1
1825
+ self[:s2] = s2
1826
+ self[:s3] = s3
1827
+ self[:s4] = s4
1828
+ self[:s5] = s5
1829
+ self[:s6] = s6
1830
+ self[:s7] = s7
1831
+ end
1983
1832
  end
1984
1833
  # Reads the s0 member
1985
1834
  def s0
@@ -2055,20 +1904,24 @@ module OpenCL
2055
1904
  end
2056
1905
  end
2057
1906
  # Maps the cl_double8 type of OpenCL
2058
- class Double8 < FFI::Struct
2059
- @size = FFI.find_type(:cl_double).size * 8
2060
- @layout = FFI::StructLayout::new([ FFI::StructLayout::Field::new( "s0", FFI.find_type(:cl_double).size * 0, FFI.find_type(:cl_double) ), FFI::StructLayout::Field::new( "s1", FFI.find_type(:cl_double).size * 1, FFI.find_type(:cl_double) ), FFI::StructLayout::Field::new( "s2", FFI.find_type(:cl_double).size * 2, FFI.find_type(:cl_double) ), FFI::StructLayout::Field::new( "s3", FFI.find_type(:cl_double).size * 3, FFI.find_type(:cl_double) ), FFI::StructLayout::Field::new( "s4", FFI.find_type(:cl_double).size * 4, FFI.find_type(:cl_double) ), FFI::StructLayout::Field::new( "s5", FFI.find_type(:cl_double).size * 5, FFI.find_type(:cl_double) ), FFI::StructLayout::Field::new( "s6", FFI.find_type(:cl_double).size * 6, FFI.find_type(:cl_double) ), FFI::StructLayout::Field::new( "s7", FFI.find_type(:cl_double).size * 7, FFI.find_type(:cl_double) ) ], FFI.find_type(:cl_double).size * 8, FFI.find_type(:cl_double).size * 8 )
2061
- # Creates a new Double8 with members set to 0 or to the user specified values
1907
+ class Double8 < Struct
1908
+ @size = OpenCL.find_type(:cl_double).size * 8
1909
+ @layout = OpenCL::StructLayout::new([ OpenCL::StructLayout::Field::new( "s0", OpenCL.find_type(:cl_double).size * 0, OpenCL.find_type(:cl_double) ), OpenCL::StructLayout::Field::new( "s1", OpenCL.find_type(:cl_double).size * 1, OpenCL.find_type(:cl_double) ), OpenCL::StructLayout::Field::new( "s2", OpenCL.find_type(:cl_double).size * 2, OpenCL.find_type(:cl_double) ), OpenCL::StructLayout::Field::new( "s3", OpenCL.find_type(:cl_double).size * 3, OpenCL.find_type(:cl_double) ), OpenCL::StructLayout::Field::new( "s4", OpenCL.find_type(:cl_double).size * 4, OpenCL.find_type(:cl_double) ), OpenCL::StructLayout::Field::new( "s5", OpenCL.find_type(:cl_double).size * 5, OpenCL.find_type(:cl_double) ), OpenCL::StructLayout::Field::new( "s6", OpenCL.find_type(:cl_double).size * 6, OpenCL.find_type(:cl_double) ), OpenCL::StructLayout::Field::new( "s7", OpenCL.find_type(:cl_double).size * 7, OpenCL.find_type(:cl_double) ) ], OpenCL.find_type(:cl_double).size * 8, OpenCL.find_type(:cl_double).size * 8 )
1910
+ # Creates a new Double8 with members set to 0 or to the user specified values. If a Pointer is passed as the first argument, Double8 maps the memory pointed.
2062
1911
  def initialize( s0 = 0.0, s1 = 0.0, s2 = 0.0, s3 = 0.0, s4 = 0.0, s5 = 0.0, s6 = 0.0, s7 = 0.0 )
2063
- super()
2064
- self[:s0] = s0
2065
- self[:s1] = s1
2066
- self[:s2] = s2
2067
- self[:s3] = s3
2068
- self[:s4] = s4
2069
- self[:s5] = s5
2070
- self[:s6] = s6
2071
- self[:s7] = s7
1912
+ if s0.is_a?(FFI::Pointer) then
1913
+ super(s0)
1914
+ else
1915
+ super()
1916
+ self[:s0] = s0
1917
+ self[:s1] = s1
1918
+ self[:s2] = s2
1919
+ self[:s3] = s3
1920
+ self[:s4] = s4
1921
+ self[:s5] = s5
1922
+ self[:s6] = s6
1923
+ self[:s7] = s7
1924
+ end
2072
1925
  end
2073
1926
  # Reads the s0 member
2074
1927
  def s0
@@ -2144,20 +1997,24 @@ module OpenCL
2144
1997
  end
2145
1998
  end
2146
1999
  # Maps the cl_half8 type of OpenCL
2147
- class Half8 < FFI::Struct
2148
- @size = FFI.find_type(:cl_half).size * 8
2149
- @layout = FFI::StructLayout::new([ FFI::StructLayout::Field::new( "s0", FFI.find_type(:cl_half).size * 0, FFI.find_type(:cl_half) ), FFI::StructLayout::Field::new( "s1", FFI.find_type(:cl_half).size * 1, FFI.find_type(:cl_half) ), FFI::StructLayout::Field::new( "s2", FFI.find_type(:cl_half).size * 2, FFI.find_type(:cl_half) ), FFI::StructLayout::Field::new( "s3", FFI.find_type(:cl_half).size * 3, FFI.find_type(:cl_half) ), FFI::StructLayout::Field::new( "s4", FFI.find_type(:cl_half).size * 4, FFI.find_type(:cl_half) ), FFI::StructLayout::Field::new( "s5", FFI.find_type(:cl_half).size * 5, FFI.find_type(:cl_half) ), FFI::StructLayout::Field::new( "s6", FFI.find_type(:cl_half).size * 6, FFI.find_type(:cl_half) ), FFI::StructLayout::Field::new( "s7", FFI.find_type(:cl_half).size * 7, FFI.find_type(:cl_half) ) ], FFI.find_type(:cl_half).size * 8, FFI.find_type(:cl_half).size * 8 )
2150
- # Creates a new Half8 with members set to 0 or to the user specified values
2000
+ class Half8 < Struct
2001
+ @size = OpenCL.find_type(:cl_half).size * 8
2002
+ @layout = OpenCL::StructLayout::new([ OpenCL::StructLayout::Field::new( "s0", OpenCL.find_type(:cl_half).size * 0, OpenCL.find_type(:cl_half) ), OpenCL::StructLayout::Field::new( "s1", OpenCL.find_type(:cl_half).size * 1, OpenCL.find_type(:cl_half) ), OpenCL::StructLayout::Field::new( "s2", OpenCL.find_type(:cl_half).size * 2, OpenCL.find_type(:cl_half) ), OpenCL::StructLayout::Field::new( "s3", OpenCL.find_type(:cl_half).size * 3, OpenCL.find_type(:cl_half) ), OpenCL::StructLayout::Field::new( "s4", OpenCL.find_type(:cl_half).size * 4, OpenCL.find_type(:cl_half) ), OpenCL::StructLayout::Field::new( "s5", OpenCL.find_type(:cl_half).size * 5, OpenCL.find_type(:cl_half) ), OpenCL::StructLayout::Field::new( "s6", OpenCL.find_type(:cl_half).size * 6, OpenCL.find_type(:cl_half) ), OpenCL::StructLayout::Field::new( "s7", OpenCL.find_type(:cl_half).size * 7, OpenCL.find_type(:cl_half) ) ], OpenCL.find_type(:cl_half).size * 8, OpenCL.find_type(:cl_half).size * 8 )
2003
+ # Creates a new Half8 with members set to 0 or to the user specified values. If a Pointer is passed as the first argument, Half8 maps the memory pointed.
2151
2004
  def initialize( s0 = 0.0, s1 = 0.0, s2 = 0.0, s3 = 0.0, s4 = 0.0, s5 = 0.0, s6 = 0.0, s7 = 0.0 )
2152
- super()
2153
- self[:s0] = s0
2154
- self[:s1] = s1
2155
- self[:s2] = s2
2156
- self[:s3] = s3
2157
- self[:s4] = s4
2158
- self[:s5] = s5
2159
- self[:s6] = s6
2160
- self[:s7] = s7
2005
+ if s0.is_a?(FFI::Pointer) then
2006
+ super(s0)
2007
+ else
2008
+ super()
2009
+ self[:s0] = s0
2010
+ self[:s1] = s1
2011
+ self[:s2] = s2
2012
+ self[:s3] = s3
2013
+ self[:s4] = s4
2014
+ self[:s5] = s5
2015
+ self[:s6] = s6
2016
+ self[:s7] = s7
2017
+ end
2161
2018
  end
2162
2019
  # Reads the s0 member
2163
2020
  def s0
@@ -2233,28 +2090,32 @@ module OpenCL
2233
2090
  end
2234
2091
  end
2235
2092
  # Maps the cl_char16 type of OpenCL
2236
- class Char16 < FFI::Struct
2237
- @size = FFI.find_type(:cl_char).size * 16
2238
- @layout = FFI::StructLayout::new([ FFI::StructLayout::Field::new( "s0", FFI.find_type(:cl_char).size * 0, FFI.find_type(:cl_char) ), FFI::StructLayout::Field::new( "s1", FFI.find_type(:cl_char).size * 1, FFI.find_type(:cl_char) ), FFI::StructLayout::Field::new( "s2", FFI.find_type(:cl_char).size * 2, FFI.find_type(:cl_char) ), FFI::StructLayout::Field::new( "s3", FFI.find_type(:cl_char).size * 3, FFI.find_type(:cl_char) ), FFI::StructLayout::Field::new( "s4", FFI.find_type(:cl_char).size * 4, FFI.find_type(:cl_char) ), FFI::StructLayout::Field::new( "s5", FFI.find_type(:cl_char).size * 5, FFI.find_type(:cl_char) ), FFI::StructLayout::Field::new( "s6", FFI.find_type(:cl_char).size * 6, FFI.find_type(:cl_char) ), FFI::StructLayout::Field::new( "s7", FFI.find_type(:cl_char).size * 7, FFI.find_type(:cl_char) ), FFI::StructLayout::Field::new( "s8", FFI.find_type(:cl_char).size * 8, FFI.find_type(:cl_char) ), FFI::StructLayout::Field::new( "s9", FFI.find_type(:cl_char).size * 9, FFI.find_type(:cl_char) ), FFI::StructLayout::Field::new( "sa", FFI.find_type(:cl_char).size * 10, FFI.find_type(:cl_char) ), FFI::StructLayout::Field::new( "sb", FFI.find_type(:cl_char).size * 11, FFI.find_type(:cl_char) ), FFI::StructLayout::Field::new( "sc", FFI.find_type(:cl_char).size * 12, FFI.find_type(:cl_char) ), FFI::StructLayout::Field::new( "sd", FFI.find_type(:cl_char).size * 13, FFI.find_type(:cl_char) ), FFI::StructLayout::Field::new( "se", FFI.find_type(:cl_char).size * 14, FFI.find_type(:cl_char) ), FFI::StructLayout::Field::new( "sf", FFI.find_type(:cl_char).size * 15, FFI.find_type(:cl_char) ) ], FFI.find_type(:cl_char).size * 16, FFI.find_type(:cl_char).size * 16 )
2239
- # Creates a new Char16 with members set to 0 or to the user specified values
2093
+ class Char16 < Struct
2094
+ @size = OpenCL.find_type(:cl_char).size * 16
2095
+ @layout = OpenCL::StructLayout::new([ OpenCL::StructLayout::Field::new( "s0", OpenCL.find_type(:cl_char).size * 0, OpenCL.find_type(:cl_char) ), OpenCL::StructLayout::Field::new( "s1", OpenCL.find_type(:cl_char).size * 1, OpenCL.find_type(:cl_char) ), OpenCL::StructLayout::Field::new( "s2", OpenCL.find_type(:cl_char).size * 2, OpenCL.find_type(:cl_char) ), OpenCL::StructLayout::Field::new( "s3", OpenCL.find_type(:cl_char).size * 3, OpenCL.find_type(:cl_char) ), OpenCL::StructLayout::Field::new( "s4", OpenCL.find_type(:cl_char).size * 4, OpenCL.find_type(:cl_char) ), OpenCL::StructLayout::Field::new( "s5", OpenCL.find_type(:cl_char).size * 5, OpenCL.find_type(:cl_char) ), OpenCL::StructLayout::Field::new( "s6", OpenCL.find_type(:cl_char).size * 6, OpenCL.find_type(:cl_char) ), OpenCL::StructLayout::Field::new( "s7", OpenCL.find_type(:cl_char).size * 7, OpenCL.find_type(:cl_char) ), OpenCL::StructLayout::Field::new( "s8", OpenCL.find_type(:cl_char).size * 8, OpenCL.find_type(:cl_char) ), OpenCL::StructLayout::Field::new( "s9", OpenCL.find_type(:cl_char).size * 9, OpenCL.find_type(:cl_char) ), OpenCL::StructLayout::Field::new( "sa", OpenCL.find_type(:cl_char).size * 10, OpenCL.find_type(:cl_char) ), OpenCL::StructLayout::Field::new( "sb", OpenCL.find_type(:cl_char).size * 11, OpenCL.find_type(:cl_char) ), OpenCL::StructLayout::Field::new( "sc", OpenCL.find_type(:cl_char).size * 12, OpenCL.find_type(:cl_char) ), OpenCL::StructLayout::Field::new( "sd", OpenCL.find_type(:cl_char).size * 13, OpenCL.find_type(:cl_char) ), OpenCL::StructLayout::Field::new( "se", OpenCL.find_type(:cl_char).size * 14, OpenCL.find_type(:cl_char) ), OpenCL::StructLayout::Field::new( "sf", OpenCL.find_type(:cl_char).size * 15, OpenCL.find_type(:cl_char) ) ], OpenCL.find_type(:cl_char).size * 16, OpenCL.find_type(:cl_char).size * 16 )
2096
+ # Creates a new Char16 with members set to 0 or to the user specified values. If a Pointer is passed as the first argument, Char16 maps the memory pointed.
2240
2097
  def initialize( s0 = 0, s1 = 0, s2 = 0, s3 = 0, s4 = 0, s5 = 0, s6 = 0, s7 = 0, s8 = 0, s9 = 0, sa = 0, sb = 0, sc = 0, sd = 0, se = 0, sf = 0 )
2241
- super()
2242
- self[:s0] = s0
2243
- self[:s1] = s1
2244
- self[:s2] = s2
2245
- self[:s3] = s3
2246
- self[:s4] = s4
2247
- self[:s5] = s5
2248
- self[:s6] = s6
2249
- self[:s7] = s7
2250
- self[:s8] = s8
2251
- self[:s9] = s9
2252
- self[:sa] = sa
2253
- self[:sb] = sb
2254
- self[:sc] = sc
2255
- self[:sd] = sd
2256
- self[:se] = se
2257
- self[:sf] = sf
2098
+ if s0.is_a?(FFI::Pointer) then
2099
+ super(s0)
2100
+ else
2101
+ super()
2102
+ self[:s0] = s0
2103
+ self[:s1] = s1
2104
+ self[:s2] = s2
2105
+ self[:s3] = s3
2106
+ self[:s4] = s4
2107
+ self[:s5] = s5
2108
+ self[:s6] = s6
2109
+ self[:s7] = s7
2110
+ self[:s8] = s8
2111
+ self[:s9] = s9
2112
+ self[:sa] = sa
2113
+ self[:sb] = sb
2114
+ self[:sc] = sc
2115
+ self[:sd] = sd
2116
+ self[:se] = se
2117
+ self[:sf] = sf
2118
+ end
2258
2119
  end
2259
2120
  # Reads the s0 member
2260
2121
  def s0
@@ -2394,28 +2255,32 @@ module OpenCL
2394
2255
  end
2395
2256
  end
2396
2257
  # Maps the cl_uchar16 type of OpenCL
2397
- class UChar16 < FFI::Struct
2398
- @size = FFI.find_type(:cl_uchar).size * 16
2399
- @layout = FFI::StructLayout::new([ FFI::StructLayout::Field::new( "s0", FFI.find_type(:cl_uchar).size * 0, FFI.find_type(:cl_uchar) ), FFI::StructLayout::Field::new( "s1", FFI.find_type(:cl_uchar).size * 1, FFI.find_type(:cl_uchar) ), FFI::StructLayout::Field::new( "s2", FFI.find_type(:cl_uchar).size * 2, FFI.find_type(:cl_uchar) ), FFI::StructLayout::Field::new( "s3", FFI.find_type(:cl_uchar).size * 3, FFI.find_type(:cl_uchar) ), FFI::StructLayout::Field::new( "s4", FFI.find_type(:cl_uchar).size * 4, FFI.find_type(:cl_uchar) ), FFI::StructLayout::Field::new( "s5", FFI.find_type(:cl_uchar).size * 5, FFI.find_type(:cl_uchar) ), FFI::StructLayout::Field::new( "s6", FFI.find_type(:cl_uchar).size * 6, FFI.find_type(:cl_uchar) ), FFI::StructLayout::Field::new( "s7", FFI.find_type(:cl_uchar).size * 7, FFI.find_type(:cl_uchar) ), FFI::StructLayout::Field::new( "s8", FFI.find_type(:cl_uchar).size * 8, FFI.find_type(:cl_uchar) ), FFI::StructLayout::Field::new( "s9", FFI.find_type(:cl_uchar).size * 9, FFI.find_type(:cl_uchar) ), FFI::StructLayout::Field::new( "sa", FFI.find_type(:cl_uchar).size * 10, FFI.find_type(:cl_uchar) ), FFI::StructLayout::Field::new( "sb", FFI.find_type(:cl_uchar).size * 11, FFI.find_type(:cl_uchar) ), FFI::StructLayout::Field::new( "sc", FFI.find_type(:cl_uchar).size * 12, FFI.find_type(:cl_uchar) ), FFI::StructLayout::Field::new( "sd", FFI.find_type(:cl_uchar).size * 13, FFI.find_type(:cl_uchar) ), FFI::StructLayout::Field::new( "se", FFI.find_type(:cl_uchar).size * 14, FFI.find_type(:cl_uchar) ), FFI::StructLayout::Field::new( "sf", FFI.find_type(:cl_uchar).size * 15, FFI.find_type(:cl_uchar) ) ], FFI.find_type(:cl_uchar).size * 16, FFI.find_type(:cl_uchar).size * 16 )
2400
- # Creates a new UChar16 with members set to 0 or to the user specified values
2258
+ class UChar16 < Struct
2259
+ @size = OpenCL.find_type(:cl_uchar).size * 16
2260
+ @layout = OpenCL::StructLayout::new([ OpenCL::StructLayout::Field::new( "s0", OpenCL.find_type(:cl_uchar).size * 0, OpenCL.find_type(:cl_uchar) ), OpenCL::StructLayout::Field::new( "s1", OpenCL.find_type(:cl_uchar).size * 1, OpenCL.find_type(:cl_uchar) ), OpenCL::StructLayout::Field::new( "s2", OpenCL.find_type(:cl_uchar).size * 2, OpenCL.find_type(:cl_uchar) ), OpenCL::StructLayout::Field::new( "s3", OpenCL.find_type(:cl_uchar).size * 3, OpenCL.find_type(:cl_uchar) ), OpenCL::StructLayout::Field::new( "s4", OpenCL.find_type(:cl_uchar).size * 4, OpenCL.find_type(:cl_uchar) ), OpenCL::StructLayout::Field::new( "s5", OpenCL.find_type(:cl_uchar).size * 5, OpenCL.find_type(:cl_uchar) ), OpenCL::StructLayout::Field::new( "s6", OpenCL.find_type(:cl_uchar).size * 6, OpenCL.find_type(:cl_uchar) ), OpenCL::StructLayout::Field::new( "s7", OpenCL.find_type(:cl_uchar).size * 7, OpenCL.find_type(:cl_uchar) ), OpenCL::StructLayout::Field::new( "s8", OpenCL.find_type(:cl_uchar).size * 8, OpenCL.find_type(:cl_uchar) ), OpenCL::StructLayout::Field::new( "s9", OpenCL.find_type(:cl_uchar).size * 9, OpenCL.find_type(:cl_uchar) ), OpenCL::StructLayout::Field::new( "sa", OpenCL.find_type(:cl_uchar).size * 10, OpenCL.find_type(:cl_uchar) ), OpenCL::StructLayout::Field::new( "sb", OpenCL.find_type(:cl_uchar).size * 11, OpenCL.find_type(:cl_uchar) ), OpenCL::StructLayout::Field::new( "sc", OpenCL.find_type(:cl_uchar).size * 12, OpenCL.find_type(:cl_uchar) ), OpenCL::StructLayout::Field::new( "sd", OpenCL.find_type(:cl_uchar).size * 13, OpenCL.find_type(:cl_uchar) ), OpenCL::StructLayout::Field::new( "se", OpenCL.find_type(:cl_uchar).size * 14, OpenCL.find_type(:cl_uchar) ), OpenCL::StructLayout::Field::new( "sf", OpenCL.find_type(:cl_uchar).size * 15, OpenCL.find_type(:cl_uchar) ) ], OpenCL.find_type(:cl_uchar).size * 16, OpenCL.find_type(:cl_uchar).size * 16 )
2261
+ # Creates a new UChar16 with members set to 0 or to the user specified values. If a Pointer is passed as the first argument, UChar16 maps the memory pointed.
2401
2262
  def initialize( s0 = 0, s1 = 0, s2 = 0, s3 = 0, s4 = 0, s5 = 0, s6 = 0, s7 = 0, s8 = 0, s9 = 0, sa = 0, sb = 0, sc = 0, sd = 0, se = 0, sf = 0 )
2402
- super()
2403
- self[:s0] = s0
2404
- self[:s1] = s1
2405
- self[:s2] = s2
2406
- self[:s3] = s3
2407
- self[:s4] = s4
2408
- self[:s5] = s5
2409
- self[:s6] = s6
2410
- self[:s7] = s7
2411
- self[:s8] = s8
2412
- self[:s9] = s9
2413
- self[:sa] = sa
2414
- self[:sb] = sb
2415
- self[:sc] = sc
2416
- self[:sd] = sd
2417
- self[:se] = se
2418
- self[:sf] = sf
2263
+ if s0.is_a?(FFI::Pointer) then
2264
+ super(s0)
2265
+ else
2266
+ super()
2267
+ self[:s0] = s0
2268
+ self[:s1] = s1
2269
+ self[:s2] = s2
2270
+ self[:s3] = s3
2271
+ self[:s4] = s4
2272
+ self[:s5] = s5
2273
+ self[:s6] = s6
2274
+ self[:s7] = s7
2275
+ self[:s8] = s8
2276
+ self[:s9] = s9
2277
+ self[:sa] = sa
2278
+ self[:sb] = sb
2279
+ self[:sc] = sc
2280
+ self[:sd] = sd
2281
+ self[:se] = se
2282
+ self[:sf] = sf
2283
+ end
2419
2284
  end
2420
2285
  # Reads the s0 member
2421
2286
  def s0
@@ -2555,28 +2420,32 @@ module OpenCL
2555
2420
  end
2556
2421
  end
2557
2422
  # Maps the cl_short16 type of OpenCL
2558
- class Short16 < FFI::Struct
2559
- @size = FFI.find_type(:cl_short).size * 16
2560
- @layout = FFI::StructLayout::new([ FFI::StructLayout::Field::new( "s0", FFI.find_type(:cl_short).size * 0, FFI.find_type(:cl_short) ), FFI::StructLayout::Field::new( "s1", FFI.find_type(:cl_short).size * 1, FFI.find_type(:cl_short) ), FFI::StructLayout::Field::new( "s2", FFI.find_type(:cl_short).size * 2, FFI.find_type(:cl_short) ), FFI::StructLayout::Field::new( "s3", FFI.find_type(:cl_short).size * 3, FFI.find_type(:cl_short) ), FFI::StructLayout::Field::new( "s4", FFI.find_type(:cl_short).size * 4, FFI.find_type(:cl_short) ), FFI::StructLayout::Field::new( "s5", FFI.find_type(:cl_short).size * 5, FFI.find_type(:cl_short) ), FFI::StructLayout::Field::new( "s6", FFI.find_type(:cl_short).size * 6, FFI.find_type(:cl_short) ), FFI::StructLayout::Field::new( "s7", FFI.find_type(:cl_short).size * 7, FFI.find_type(:cl_short) ), FFI::StructLayout::Field::new( "s8", FFI.find_type(:cl_short).size * 8, FFI.find_type(:cl_short) ), FFI::StructLayout::Field::new( "s9", FFI.find_type(:cl_short).size * 9, FFI.find_type(:cl_short) ), FFI::StructLayout::Field::new( "sa", FFI.find_type(:cl_short).size * 10, FFI.find_type(:cl_short) ), FFI::StructLayout::Field::new( "sb", FFI.find_type(:cl_short).size * 11, FFI.find_type(:cl_short) ), FFI::StructLayout::Field::new( "sc", FFI.find_type(:cl_short).size * 12, FFI.find_type(:cl_short) ), FFI::StructLayout::Field::new( "sd", FFI.find_type(:cl_short).size * 13, FFI.find_type(:cl_short) ), FFI::StructLayout::Field::new( "se", FFI.find_type(:cl_short).size * 14, FFI.find_type(:cl_short) ), FFI::StructLayout::Field::new( "sf", FFI.find_type(:cl_short).size * 15, FFI.find_type(:cl_short) ) ], FFI.find_type(:cl_short).size * 16, FFI.find_type(:cl_short).size * 16 )
2561
- # Creates a new Short16 with members set to 0 or to the user specified values
2423
+ class Short16 < Struct
2424
+ @size = OpenCL.find_type(:cl_short).size * 16
2425
+ @layout = OpenCL::StructLayout::new([ OpenCL::StructLayout::Field::new( "s0", OpenCL.find_type(:cl_short).size * 0, OpenCL.find_type(:cl_short) ), OpenCL::StructLayout::Field::new( "s1", OpenCL.find_type(:cl_short).size * 1, OpenCL.find_type(:cl_short) ), OpenCL::StructLayout::Field::new( "s2", OpenCL.find_type(:cl_short).size * 2, OpenCL.find_type(:cl_short) ), OpenCL::StructLayout::Field::new( "s3", OpenCL.find_type(:cl_short).size * 3, OpenCL.find_type(:cl_short) ), OpenCL::StructLayout::Field::new( "s4", OpenCL.find_type(:cl_short).size * 4, OpenCL.find_type(:cl_short) ), OpenCL::StructLayout::Field::new( "s5", OpenCL.find_type(:cl_short).size * 5, OpenCL.find_type(:cl_short) ), OpenCL::StructLayout::Field::new( "s6", OpenCL.find_type(:cl_short).size * 6, OpenCL.find_type(:cl_short) ), OpenCL::StructLayout::Field::new( "s7", OpenCL.find_type(:cl_short).size * 7, OpenCL.find_type(:cl_short) ), OpenCL::StructLayout::Field::new( "s8", OpenCL.find_type(:cl_short).size * 8, OpenCL.find_type(:cl_short) ), OpenCL::StructLayout::Field::new( "s9", OpenCL.find_type(:cl_short).size * 9, OpenCL.find_type(:cl_short) ), OpenCL::StructLayout::Field::new( "sa", OpenCL.find_type(:cl_short).size * 10, OpenCL.find_type(:cl_short) ), OpenCL::StructLayout::Field::new( "sb", OpenCL.find_type(:cl_short).size * 11, OpenCL.find_type(:cl_short) ), OpenCL::StructLayout::Field::new( "sc", OpenCL.find_type(:cl_short).size * 12, OpenCL.find_type(:cl_short) ), OpenCL::StructLayout::Field::new( "sd", OpenCL.find_type(:cl_short).size * 13, OpenCL.find_type(:cl_short) ), OpenCL::StructLayout::Field::new( "se", OpenCL.find_type(:cl_short).size * 14, OpenCL.find_type(:cl_short) ), OpenCL::StructLayout::Field::new( "sf", OpenCL.find_type(:cl_short).size * 15, OpenCL.find_type(:cl_short) ) ], OpenCL.find_type(:cl_short).size * 16, OpenCL.find_type(:cl_short).size * 16 )
2426
+ # Creates a new Short16 with members set to 0 or to the user specified values. If a Pointer is passed as the first argument, Short16 maps the memory pointed.
2562
2427
  def initialize( s0 = 0, s1 = 0, s2 = 0, s3 = 0, s4 = 0, s5 = 0, s6 = 0, s7 = 0, s8 = 0, s9 = 0, sa = 0, sb = 0, sc = 0, sd = 0, se = 0, sf = 0 )
2563
- super()
2564
- self[:s0] = s0
2565
- self[:s1] = s1
2566
- self[:s2] = s2
2567
- self[:s3] = s3
2568
- self[:s4] = s4
2569
- self[:s5] = s5
2570
- self[:s6] = s6
2571
- self[:s7] = s7
2572
- self[:s8] = s8
2573
- self[:s9] = s9
2574
- self[:sa] = sa
2575
- self[:sb] = sb
2576
- self[:sc] = sc
2577
- self[:sd] = sd
2578
- self[:se] = se
2579
- self[:sf] = sf
2428
+ if s0.is_a?(FFI::Pointer) then
2429
+ super(s0)
2430
+ else
2431
+ super()
2432
+ self[:s0] = s0
2433
+ self[:s1] = s1
2434
+ self[:s2] = s2
2435
+ self[:s3] = s3
2436
+ self[:s4] = s4
2437
+ self[:s5] = s5
2438
+ self[:s6] = s6
2439
+ self[:s7] = s7
2440
+ self[:s8] = s8
2441
+ self[:s9] = s9
2442
+ self[:sa] = sa
2443
+ self[:sb] = sb
2444
+ self[:sc] = sc
2445
+ self[:sd] = sd
2446
+ self[:se] = se
2447
+ self[:sf] = sf
2448
+ end
2580
2449
  end
2581
2450
  # Reads the s0 member
2582
2451
  def s0
@@ -2716,28 +2585,32 @@ module OpenCL
2716
2585
  end
2717
2586
  end
2718
2587
  # Maps the cl_ushort16 type of OpenCL
2719
- class UShort16 < FFI::Struct
2720
- @size = FFI.find_type(:cl_ushort).size * 16
2721
- @layout = FFI::StructLayout::new([ FFI::StructLayout::Field::new( "s0", FFI.find_type(:cl_ushort).size * 0, FFI.find_type(:cl_ushort) ), FFI::StructLayout::Field::new( "s1", FFI.find_type(:cl_ushort).size * 1, FFI.find_type(:cl_ushort) ), FFI::StructLayout::Field::new( "s2", FFI.find_type(:cl_ushort).size * 2, FFI.find_type(:cl_ushort) ), FFI::StructLayout::Field::new( "s3", FFI.find_type(:cl_ushort).size * 3, FFI.find_type(:cl_ushort) ), FFI::StructLayout::Field::new( "s4", FFI.find_type(:cl_ushort).size * 4, FFI.find_type(:cl_ushort) ), FFI::StructLayout::Field::new( "s5", FFI.find_type(:cl_ushort).size * 5, FFI.find_type(:cl_ushort) ), FFI::StructLayout::Field::new( "s6", FFI.find_type(:cl_ushort).size * 6, FFI.find_type(:cl_ushort) ), FFI::StructLayout::Field::new( "s7", FFI.find_type(:cl_ushort).size * 7, FFI.find_type(:cl_ushort) ), FFI::StructLayout::Field::new( "s8", FFI.find_type(:cl_ushort).size * 8, FFI.find_type(:cl_ushort) ), FFI::StructLayout::Field::new( "s9", FFI.find_type(:cl_ushort).size * 9, FFI.find_type(:cl_ushort) ), FFI::StructLayout::Field::new( "sa", FFI.find_type(:cl_ushort).size * 10, FFI.find_type(:cl_ushort) ), FFI::StructLayout::Field::new( "sb", FFI.find_type(:cl_ushort).size * 11, FFI.find_type(:cl_ushort) ), FFI::StructLayout::Field::new( "sc", FFI.find_type(:cl_ushort).size * 12, FFI.find_type(:cl_ushort) ), FFI::StructLayout::Field::new( "sd", FFI.find_type(:cl_ushort).size * 13, FFI.find_type(:cl_ushort) ), FFI::StructLayout::Field::new( "se", FFI.find_type(:cl_ushort).size * 14, FFI.find_type(:cl_ushort) ), FFI::StructLayout::Field::new( "sf", FFI.find_type(:cl_ushort).size * 15, FFI.find_type(:cl_ushort) ) ], FFI.find_type(:cl_ushort).size * 16, FFI.find_type(:cl_ushort).size * 16 )
2722
- # Creates a new UShort16 with members set to 0 or to the user specified values
2588
+ class UShort16 < Struct
2589
+ @size = OpenCL.find_type(:cl_ushort).size * 16
2590
+ @layout = OpenCL::StructLayout::new([ OpenCL::StructLayout::Field::new( "s0", OpenCL.find_type(:cl_ushort).size * 0, OpenCL.find_type(:cl_ushort) ), OpenCL::StructLayout::Field::new( "s1", OpenCL.find_type(:cl_ushort).size * 1, OpenCL.find_type(:cl_ushort) ), OpenCL::StructLayout::Field::new( "s2", OpenCL.find_type(:cl_ushort).size * 2, OpenCL.find_type(:cl_ushort) ), OpenCL::StructLayout::Field::new( "s3", OpenCL.find_type(:cl_ushort).size * 3, OpenCL.find_type(:cl_ushort) ), OpenCL::StructLayout::Field::new( "s4", OpenCL.find_type(:cl_ushort).size * 4, OpenCL.find_type(:cl_ushort) ), OpenCL::StructLayout::Field::new( "s5", OpenCL.find_type(:cl_ushort).size * 5, OpenCL.find_type(:cl_ushort) ), OpenCL::StructLayout::Field::new( "s6", OpenCL.find_type(:cl_ushort).size * 6, OpenCL.find_type(:cl_ushort) ), OpenCL::StructLayout::Field::new( "s7", OpenCL.find_type(:cl_ushort).size * 7, OpenCL.find_type(:cl_ushort) ), OpenCL::StructLayout::Field::new( "s8", OpenCL.find_type(:cl_ushort).size * 8, OpenCL.find_type(:cl_ushort) ), OpenCL::StructLayout::Field::new( "s9", OpenCL.find_type(:cl_ushort).size * 9, OpenCL.find_type(:cl_ushort) ), OpenCL::StructLayout::Field::new( "sa", OpenCL.find_type(:cl_ushort).size * 10, OpenCL.find_type(:cl_ushort) ), OpenCL::StructLayout::Field::new( "sb", OpenCL.find_type(:cl_ushort).size * 11, OpenCL.find_type(:cl_ushort) ), OpenCL::StructLayout::Field::new( "sc", OpenCL.find_type(:cl_ushort).size * 12, OpenCL.find_type(:cl_ushort) ), OpenCL::StructLayout::Field::new( "sd", OpenCL.find_type(:cl_ushort).size * 13, OpenCL.find_type(:cl_ushort) ), OpenCL::StructLayout::Field::new( "se", OpenCL.find_type(:cl_ushort).size * 14, OpenCL.find_type(:cl_ushort) ), OpenCL::StructLayout::Field::new( "sf", OpenCL.find_type(:cl_ushort).size * 15, OpenCL.find_type(:cl_ushort) ) ], OpenCL.find_type(:cl_ushort).size * 16, OpenCL.find_type(:cl_ushort).size * 16 )
2591
+ # Creates a new UShort16 with members set to 0 or to the user specified values. If a Pointer is passed as the first argument, UShort16 maps the memory pointed.
2723
2592
  def initialize( s0 = 0, s1 = 0, s2 = 0, s3 = 0, s4 = 0, s5 = 0, s6 = 0, s7 = 0, s8 = 0, s9 = 0, sa = 0, sb = 0, sc = 0, sd = 0, se = 0, sf = 0 )
2724
- super()
2725
- self[:s0] = s0
2726
- self[:s1] = s1
2727
- self[:s2] = s2
2728
- self[:s3] = s3
2729
- self[:s4] = s4
2730
- self[:s5] = s5
2731
- self[:s6] = s6
2732
- self[:s7] = s7
2733
- self[:s8] = s8
2734
- self[:s9] = s9
2735
- self[:sa] = sa
2736
- self[:sb] = sb
2737
- self[:sc] = sc
2738
- self[:sd] = sd
2739
- self[:se] = se
2740
- self[:sf] = sf
2593
+ if s0.is_a?(FFI::Pointer) then
2594
+ super(s0)
2595
+ else
2596
+ super()
2597
+ self[:s0] = s0
2598
+ self[:s1] = s1
2599
+ self[:s2] = s2
2600
+ self[:s3] = s3
2601
+ self[:s4] = s4
2602
+ self[:s5] = s5
2603
+ self[:s6] = s6
2604
+ self[:s7] = s7
2605
+ self[:s8] = s8
2606
+ self[:s9] = s9
2607
+ self[:sa] = sa
2608
+ self[:sb] = sb
2609
+ self[:sc] = sc
2610
+ self[:sd] = sd
2611
+ self[:se] = se
2612
+ self[:sf] = sf
2613
+ end
2741
2614
  end
2742
2615
  # Reads the s0 member
2743
2616
  def s0
@@ -2877,28 +2750,32 @@ module OpenCL
2877
2750
  end
2878
2751
  end
2879
2752
  # Maps the cl_int16 type of OpenCL
2880
- class Int16 < FFI::Struct
2881
- @size = FFI.find_type(:cl_int).size * 16
2882
- @layout = FFI::StructLayout::new([ FFI::StructLayout::Field::new( "s0", FFI.find_type(:cl_int).size * 0, FFI.find_type(:cl_int) ), FFI::StructLayout::Field::new( "s1", FFI.find_type(:cl_int).size * 1, FFI.find_type(:cl_int) ), FFI::StructLayout::Field::new( "s2", FFI.find_type(:cl_int).size * 2, FFI.find_type(:cl_int) ), FFI::StructLayout::Field::new( "s3", FFI.find_type(:cl_int).size * 3, FFI.find_type(:cl_int) ), FFI::StructLayout::Field::new( "s4", FFI.find_type(:cl_int).size * 4, FFI.find_type(:cl_int) ), FFI::StructLayout::Field::new( "s5", FFI.find_type(:cl_int).size * 5, FFI.find_type(:cl_int) ), FFI::StructLayout::Field::new( "s6", FFI.find_type(:cl_int).size * 6, FFI.find_type(:cl_int) ), FFI::StructLayout::Field::new( "s7", FFI.find_type(:cl_int).size * 7, FFI.find_type(:cl_int) ), FFI::StructLayout::Field::new( "s8", FFI.find_type(:cl_int).size * 8, FFI.find_type(:cl_int) ), FFI::StructLayout::Field::new( "s9", FFI.find_type(:cl_int).size * 9, FFI.find_type(:cl_int) ), FFI::StructLayout::Field::new( "sa", FFI.find_type(:cl_int).size * 10, FFI.find_type(:cl_int) ), FFI::StructLayout::Field::new( "sb", FFI.find_type(:cl_int).size * 11, FFI.find_type(:cl_int) ), FFI::StructLayout::Field::new( "sc", FFI.find_type(:cl_int).size * 12, FFI.find_type(:cl_int) ), FFI::StructLayout::Field::new( "sd", FFI.find_type(:cl_int).size * 13, FFI.find_type(:cl_int) ), FFI::StructLayout::Field::new( "se", FFI.find_type(:cl_int).size * 14, FFI.find_type(:cl_int) ), FFI::StructLayout::Field::new( "sf", FFI.find_type(:cl_int).size * 15, FFI.find_type(:cl_int) ) ], FFI.find_type(:cl_int).size * 16, FFI.find_type(:cl_int).size * 16 )
2883
- # Creates a new Int16 with members set to 0 or to the user specified values
2753
+ class Int16 < Struct
2754
+ @size = OpenCL.find_type(:cl_int).size * 16
2755
+ @layout = OpenCL::StructLayout::new([ OpenCL::StructLayout::Field::new( "s0", OpenCL.find_type(:cl_int).size * 0, OpenCL.find_type(:cl_int) ), OpenCL::StructLayout::Field::new( "s1", OpenCL.find_type(:cl_int).size * 1, OpenCL.find_type(:cl_int) ), OpenCL::StructLayout::Field::new( "s2", OpenCL.find_type(:cl_int).size * 2, OpenCL.find_type(:cl_int) ), OpenCL::StructLayout::Field::new( "s3", OpenCL.find_type(:cl_int).size * 3, OpenCL.find_type(:cl_int) ), OpenCL::StructLayout::Field::new( "s4", OpenCL.find_type(:cl_int).size * 4, OpenCL.find_type(:cl_int) ), OpenCL::StructLayout::Field::new( "s5", OpenCL.find_type(:cl_int).size * 5, OpenCL.find_type(:cl_int) ), OpenCL::StructLayout::Field::new( "s6", OpenCL.find_type(:cl_int).size * 6, OpenCL.find_type(:cl_int) ), OpenCL::StructLayout::Field::new( "s7", OpenCL.find_type(:cl_int).size * 7, OpenCL.find_type(:cl_int) ), OpenCL::StructLayout::Field::new( "s8", OpenCL.find_type(:cl_int).size * 8, OpenCL.find_type(:cl_int) ), OpenCL::StructLayout::Field::new( "s9", OpenCL.find_type(:cl_int).size * 9, OpenCL.find_type(:cl_int) ), OpenCL::StructLayout::Field::new( "sa", OpenCL.find_type(:cl_int).size * 10, OpenCL.find_type(:cl_int) ), OpenCL::StructLayout::Field::new( "sb", OpenCL.find_type(:cl_int).size * 11, OpenCL.find_type(:cl_int) ), OpenCL::StructLayout::Field::new( "sc", OpenCL.find_type(:cl_int).size * 12, OpenCL.find_type(:cl_int) ), OpenCL::StructLayout::Field::new( "sd", OpenCL.find_type(:cl_int).size * 13, OpenCL.find_type(:cl_int) ), OpenCL::StructLayout::Field::new( "se", OpenCL.find_type(:cl_int).size * 14, OpenCL.find_type(:cl_int) ), OpenCL::StructLayout::Field::new( "sf", OpenCL.find_type(:cl_int).size * 15, OpenCL.find_type(:cl_int) ) ], OpenCL.find_type(:cl_int).size * 16, OpenCL.find_type(:cl_int).size * 16 )
2756
+ # Creates a new Int16 with members set to 0 or to the user specified values. If a Pointer is passed as the first argument, Int16 maps the memory pointed.
2884
2757
  def initialize( s0 = 0, s1 = 0, s2 = 0, s3 = 0, s4 = 0, s5 = 0, s6 = 0, s7 = 0, s8 = 0, s9 = 0, sa = 0, sb = 0, sc = 0, sd = 0, se = 0, sf = 0 )
2885
- super()
2886
- self[:s0] = s0
2887
- self[:s1] = s1
2888
- self[:s2] = s2
2889
- self[:s3] = s3
2890
- self[:s4] = s4
2891
- self[:s5] = s5
2892
- self[:s6] = s6
2893
- self[:s7] = s7
2894
- self[:s8] = s8
2895
- self[:s9] = s9
2896
- self[:sa] = sa
2897
- self[:sb] = sb
2898
- self[:sc] = sc
2899
- self[:sd] = sd
2900
- self[:se] = se
2901
- self[:sf] = sf
2758
+ if s0.is_a?(FFI::Pointer) then
2759
+ super(s0)
2760
+ else
2761
+ super()
2762
+ self[:s0] = s0
2763
+ self[:s1] = s1
2764
+ self[:s2] = s2
2765
+ self[:s3] = s3
2766
+ self[:s4] = s4
2767
+ self[:s5] = s5
2768
+ self[:s6] = s6
2769
+ self[:s7] = s7
2770
+ self[:s8] = s8
2771
+ self[:s9] = s9
2772
+ self[:sa] = sa
2773
+ self[:sb] = sb
2774
+ self[:sc] = sc
2775
+ self[:sd] = sd
2776
+ self[:se] = se
2777
+ self[:sf] = sf
2778
+ end
2902
2779
  end
2903
2780
  # Reads the s0 member
2904
2781
  def s0
@@ -3038,28 +2915,32 @@ module OpenCL
3038
2915
  end
3039
2916
  end
3040
2917
  # Maps the cl_uint16 type of OpenCL
3041
- class UInt16 < FFI::Struct
3042
- @size = FFI.find_type(:cl_uint).size * 16
3043
- @layout = FFI::StructLayout::new([ FFI::StructLayout::Field::new( "s0", FFI.find_type(:cl_uint).size * 0, FFI.find_type(:cl_uint) ), FFI::StructLayout::Field::new( "s1", FFI.find_type(:cl_uint).size * 1, FFI.find_type(:cl_uint) ), FFI::StructLayout::Field::new( "s2", FFI.find_type(:cl_uint).size * 2, FFI.find_type(:cl_uint) ), FFI::StructLayout::Field::new( "s3", FFI.find_type(:cl_uint).size * 3, FFI.find_type(:cl_uint) ), FFI::StructLayout::Field::new( "s4", FFI.find_type(:cl_uint).size * 4, FFI.find_type(:cl_uint) ), FFI::StructLayout::Field::new( "s5", FFI.find_type(:cl_uint).size * 5, FFI.find_type(:cl_uint) ), FFI::StructLayout::Field::new( "s6", FFI.find_type(:cl_uint).size * 6, FFI.find_type(:cl_uint) ), FFI::StructLayout::Field::new( "s7", FFI.find_type(:cl_uint).size * 7, FFI.find_type(:cl_uint) ), FFI::StructLayout::Field::new( "s8", FFI.find_type(:cl_uint).size * 8, FFI.find_type(:cl_uint) ), FFI::StructLayout::Field::new( "s9", FFI.find_type(:cl_uint).size * 9, FFI.find_type(:cl_uint) ), FFI::StructLayout::Field::new( "sa", FFI.find_type(:cl_uint).size * 10, FFI.find_type(:cl_uint) ), FFI::StructLayout::Field::new( "sb", FFI.find_type(:cl_uint).size * 11, FFI.find_type(:cl_uint) ), FFI::StructLayout::Field::new( "sc", FFI.find_type(:cl_uint).size * 12, FFI.find_type(:cl_uint) ), FFI::StructLayout::Field::new( "sd", FFI.find_type(:cl_uint).size * 13, FFI.find_type(:cl_uint) ), FFI::StructLayout::Field::new( "se", FFI.find_type(:cl_uint).size * 14, FFI.find_type(:cl_uint) ), FFI::StructLayout::Field::new( "sf", FFI.find_type(:cl_uint).size * 15, FFI.find_type(:cl_uint) ) ], FFI.find_type(:cl_uint).size * 16, FFI.find_type(:cl_uint).size * 16 )
3044
- # Creates a new UInt16 with members set to 0 or to the user specified values
2918
+ class UInt16 < Struct
2919
+ @size = OpenCL.find_type(:cl_uint).size * 16
2920
+ @layout = OpenCL::StructLayout::new([ OpenCL::StructLayout::Field::new( "s0", OpenCL.find_type(:cl_uint).size * 0, OpenCL.find_type(:cl_uint) ), OpenCL::StructLayout::Field::new( "s1", OpenCL.find_type(:cl_uint).size * 1, OpenCL.find_type(:cl_uint) ), OpenCL::StructLayout::Field::new( "s2", OpenCL.find_type(:cl_uint).size * 2, OpenCL.find_type(:cl_uint) ), OpenCL::StructLayout::Field::new( "s3", OpenCL.find_type(:cl_uint).size * 3, OpenCL.find_type(:cl_uint) ), OpenCL::StructLayout::Field::new( "s4", OpenCL.find_type(:cl_uint).size * 4, OpenCL.find_type(:cl_uint) ), OpenCL::StructLayout::Field::new( "s5", OpenCL.find_type(:cl_uint).size * 5, OpenCL.find_type(:cl_uint) ), OpenCL::StructLayout::Field::new( "s6", OpenCL.find_type(:cl_uint).size * 6, OpenCL.find_type(:cl_uint) ), OpenCL::StructLayout::Field::new( "s7", OpenCL.find_type(:cl_uint).size * 7, OpenCL.find_type(:cl_uint) ), OpenCL::StructLayout::Field::new( "s8", OpenCL.find_type(:cl_uint).size * 8, OpenCL.find_type(:cl_uint) ), OpenCL::StructLayout::Field::new( "s9", OpenCL.find_type(:cl_uint).size * 9, OpenCL.find_type(:cl_uint) ), OpenCL::StructLayout::Field::new( "sa", OpenCL.find_type(:cl_uint).size * 10, OpenCL.find_type(:cl_uint) ), OpenCL::StructLayout::Field::new( "sb", OpenCL.find_type(:cl_uint).size * 11, OpenCL.find_type(:cl_uint) ), OpenCL::StructLayout::Field::new( "sc", OpenCL.find_type(:cl_uint).size * 12, OpenCL.find_type(:cl_uint) ), OpenCL::StructLayout::Field::new( "sd", OpenCL.find_type(:cl_uint).size * 13, OpenCL.find_type(:cl_uint) ), OpenCL::StructLayout::Field::new( "se", OpenCL.find_type(:cl_uint).size * 14, OpenCL.find_type(:cl_uint) ), OpenCL::StructLayout::Field::new( "sf", OpenCL.find_type(:cl_uint).size * 15, OpenCL.find_type(:cl_uint) ) ], OpenCL.find_type(:cl_uint).size * 16, OpenCL.find_type(:cl_uint).size * 16 )
2921
+ # Creates a new UInt16 with members set to 0 or to the user specified values. If a Pointer is passed as the first argument, UInt16 maps the memory pointed.
3045
2922
  def initialize( s0 = 0, s1 = 0, s2 = 0, s3 = 0, s4 = 0, s5 = 0, s6 = 0, s7 = 0, s8 = 0, s9 = 0, sa = 0, sb = 0, sc = 0, sd = 0, se = 0, sf = 0 )
3046
- super()
3047
- self[:s0] = s0
3048
- self[:s1] = s1
3049
- self[:s2] = s2
3050
- self[:s3] = s3
3051
- self[:s4] = s4
3052
- self[:s5] = s5
3053
- self[:s6] = s6
3054
- self[:s7] = s7
3055
- self[:s8] = s8
3056
- self[:s9] = s9
3057
- self[:sa] = sa
3058
- self[:sb] = sb
3059
- self[:sc] = sc
3060
- self[:sd] = sd
3061
- self[:se] = se
3062
- self[:sf] = sf
2923
+ if s0.is_a?(FFI::Pointer) then
2924
+ super(s0)
2925
+ else
2926
+ super()
2927
+ self[:s0] = s0
2928
+ self[:s1] = s1
2929
+ self[:s2] = s2
2930
+ self[:s3] = s3
2931
+ self[:s4] = s4
2932
+ self[:s5] = s5
2933
+ self[:s6] = s6
2934
+ self[:s7] = s7
2935
+ self[:s8] = s8
2936
+ self[:s9] = s9
2937
+ self[:sa] = sa
2938
+ self[:sb] = sb
2939
+ self[:sc] = sc
2940
+ self[:sd] = sd
2941
+ self[:se] = se
2942
+ self[:sf] = sf
2943
+ end
3063
2944
  end
3064
2945
  # Reads the s0 member
3065
2946
  def s0
@@ -3199,28 +3080,32 @@ module OpenCL
3199
3080
  end
3200
3081
  end
3201
3082
  # Maps the cl_long16 type of OpenCL
3202
- class Long16 < FFI::Struct
3203
- @size = FFI.find_type(:cl_long).size * 16
3204
- @layout = FFI::StructLayout::new([ FFI::StructLayout::Field::new( "s0", FFI.find_type(:cl_long).size * 0, FFI.find_type(:cl_long) ), FFI::StructLayout::Field::new( "s1", FFI.find_type(:cl_long).size * 1, FFI.find_type(:cl_long) ), FFI::StructLayout::Field::new( "s2", FFI.find_type(:cl_long).size * 2, FFI.find_type(:cl_long) ), FFI::StructLayout::Field::new( "s3", FFI.find_type(:cl_long).size * 3, FFI.find_type(:cl_long) ), FFI::StructLayout::Field::new( "s4", FFI.find_type(:cl_long).size * 4, FFI.find_type(:cl_long) ), FFI::StructLayout::Field::new( "s5", FFI.find_type(:cl_long).size * 5, FFI.find_type(:cl_long) ), FFI::StructLayout::Field::new( "s6", FFI.find_type(:cl_long).size * 6, FFI.find_type(:cl_long) ), FFI::StructLayout::Field::new( "s7", FFI.find_type(:cl_long).size * 7, FFI.find_type(:cl_long) ), FFI::StructLayout::Field::new( "s8", FFI.find_type(:cl_long).size * 8, FFI.find_type(:cl_long) ), FFI::StructLayout::Field::new( "s9", FFI.find_type(:cl_long).size * 9, FFI.find_type(:cl_long) ), FFI::StructLayout::Field::new( "sa", FFI.find_type(:cl_long).size * 10, FFI.find_type(:cl_long) ), FFI::StructLayout::Field::new( "sb", FFI.find_type(:cl_long).size * 11, FFI.find_type(:cl_long) ), FFI::StructLayout::Field::new( "sc", FFI.find_type(:cl_long).size * 12, FFI.find_type(:cl_long) ), FFI::StructLayout::Field::new( "sd", FFI.find_type(:cl_long).size * 13, FFI.find_type(:cl_long) ), FFI::StructLayout::Field::new( "se", FFI.find_type(:cl_long).size * 14, FFI.find_type(:cl_long) ), FFI::StructLayout::Field::new( "sf", FFI.find_type(:cl_long).size * 15, FFI.find_type(:cl_long) ) ], FFI.find_type(:cl_long).size * 16, FFI.find_type(:cl_long).size * 16 )
3205
- # Creates a new Long16 with members set to 0 or to the user specified values
3083
+ class Long16 < Struct
3084
+ @size = OpenCL.find_type(:cl_long).size * 16
3085
+ @layout = OpenCL::StructLayout::new([ OpenCL::StructLayout::Field::new( "s0", OpenCL.find_type(:cl_long).size * 0, OpenCL.find_type(:cl_long) ), OpenCL::StructLayout::Field::new( "s1", OpenCL.find_type(:cl_long).size * 1, OpenCL.find_type(:cl_long) ), OpenCL::StructLayout::Field::new( "s2", OpenCL.find_type(:cl_long).size * 2, OpenCL.find_type(:cl_long) ), OpenCL::StructLayout::Field::new( "s3", OpenCL.find_type(:cl_long).size * 3, OpenCL.find_type(:cl_long) ), OpenCL::StructLayout::Field::new( "s4", OpenCL.find_type(:cl_long).size * 4, OpenCL.find_type(:cl_long) ), OpenCL::StructLayout::Field::new( "s5", OpenCL.find_type(:cl_long).size * 5, OpenCL.find_type(:cl_long) ), OpenCL::StructLayout::Field::new( "s6", OpenCL.find_type(:cl_long).size * 6, OpenCL.find_type(:cl_long) ), OpenCL::StructLayout::Field::new( "s7", OpenCL.find_type(:cl_long).size * 7, OpenCL.find_type(:cl_long) ), OpenCL::StructLayout::Field::new( "s8", OpenCL.find_type(:cl_long).size * 8, OpenCL.find_type(:cl_long) ), OpenCL::StructLayout::Field::new( "s9", OpenCL.find_type(:cl_long).size * 9, OpenCL.find_type(:cl_long) ), OpenCL::StructLayout::Field::new( "sa", OpenCL.find_type(:cl_long).size * 10, OpenCL.find_type(:cl_long) ), OpenCL::StructLayout::Field::new( "sb", OpenCL.find_type(:cl_long).size * 11, OpenCL.find_type(:cl_long) ), OpenCL::StructLayout::Field::new( "sc", OpenCL.find_type(:cl_long).size * 12, OpenCL.find_type(:cl_long) ), OpenCL::StructLayout::Field::new( "sd", OpenCL.find_type(:cl_long).size * 13, OpenCL.find_type(:cl_long) ), OpenCL::StructLayout::Field::new( "se", OpenCL.find_type(:cl_long).size * 14, OpenCL.find_type(:cl_long) ), OpenCL::StructLayout::Field::new( "sf", OpenCL.find_type(:cl_long).size * 15, OpenCL.find_type(:cl_long) ) ], OpenCL.find_type(:cl_long).size * 16, OpenCL.find_type(:cl_long).size * 16 )
3086
+ # Creates a new Long16 with members set to 0 or to the user specified values. If a Pointer is passed as the first argument, Long16 maps the memory pointed.
3206
3087
  def initialize( s0 = 0, s1 = 0, s2 = 0, s3 = 0, s4 = 0, s5 = 0, s6 = 0, s7 = 0, s8 = 0, s9 = 0, sa = 0, sb = 0, sc = 0, sd = 0, se = 0, sf = 0 )
3207
- super()
3208
- self[:s0] = s0
3209
- self[:s1] = s1
3210
- self[:s2] = s2
3211
- self[:s3] = s3
3212
- self[:s4] = s4
3213
- self[:s5] = s5
3214
- self[:s6] = s6
3215
- self[:s7] = s7
3216
- self[:s8] = s8
3217
- self[:s9] = s9
3218
- self[:sa] = sa
3219
- self[:sb] = sb
3220
- self[:sc] = sc
3221
- self[:sd] = sd
3222
- self[:se] = se
3223
- self[:sf] = sf
3088
+ if s0.is_a?(FFI::Pointer) then
3089
+ super(s0)
3090
+ else
3091
+ super()
3092
+ self[:s0] = s0
3093
+ self[:s1] = s1
3094
+ self[:s2] = s2
3095
+ self[:s3] = s3
3096
+ self[:s4] = s4
3097
+ self[:s5] = s5
3098
+ self[:s6] = s6
3099
+ self[:s7] = s7
3100
+ self[:s8] = s8
3101
+ self[:s9] = s9
3102
+ self[:sa] = sa
3103
+ self[:sb] = sb
3104
+ self[:sc] = sc
3105
+ self[:sd] = sd
3106
+ self[:se] = se
3107
+ self[:sf] = sf
3108
+ end
3224
3109
  end
3225
3110
  # Reads the s0 member
3226
3111
  def s0
@@ -3360,28 +3245,32 @@ module OpenCL
3360
3245
  end
3361
3246
  end
3362
3247
  # Maps the cl_ulong16 type of OpenCL
3363
- class ULong16 < FFI::Struct
3364
- @size = FFI.find_type(:cl_ulong).size * 16
3365
- @layout = FFI::StructLayout::new([ FFI::StructLayout::Field::new( "s0", FFI.find_type(:cl_ulong).size * 0, FFI.find_type(:cl_ulong) ), FFI::StructLayout::Field::new( "s1", FFI.find_type(:cl_ulong).size * 1, FFI.find_type(:cl_ulong) ), FFI::StructLayout::Field::new( "s2", FFI.find_type(:cl_ulong).size * 2, FFI.find_type(:cl_ulong) ), FFI::StructLayout::Field::new( "s3", FFI.find_type(:cl_ulong).size * 3, FFI.find_type(:cl_ulong) ), FFI::StructLayout::Field::new( "s4", FFI.find_type(:cl_ulong).size * 4, FFI.find_type(:cl_ulong) ), FFI::StructLayout::Field::new( "s5", FFI.find_type(:cl_ulong).size * 5, FFI.find_type(:cl_ulong) ), FFI::StructLayout::Field::new( "s6", FFI.find_type(:cl_ulong).size * 6, FFI.find_type(:cl_ulong) ), FFI::StructLayout::Field::new( "s7", FFI.find_type(:cl_ulong).size * 7, FFI.find_type(:cl_ulong) ), FFI::StructLayout::Field::new( "s8", FFI.find_type(:cl_ulong).size * 8, FFI.find_type(:cl_ulong) ), FFI::StructLayout::Field::new( "s9", FFI.find_type(:cl_ulong).size * 9, FFI.find_type(:cl_ulong) ), FFI::StructLayout::Field::new( "sa", FFI.find_type(:cl_ulong).size * 10, FFI.find_type(:cl_ulong) ), FFI::StructLayout::Field::new( "sb", FFI.find_type(:cl_ulong).size * 11, FFI.find_type(:cl_ulong) ), FFI::StructLayout::Field::new( "sc", FFI.find_type(:cl_ulong).size * 12, FFI.find_type(:cl_ulong) ), FFI::StructLayout::Field::new( "sd", FFI.find_type(:cl_ulong).size * 13, FFI.find_type(:cl_ulong) ), FFI::StructLayout::Field::new( "se", FFI.find_type(:cl_ulong).size * 14, FFI.find_type(:cl_ulong) ), FFI::StructLayout::Field::new( "sf", FFI.find_type(:cl_ulong).size * 15, FFI.find_type(:cl_ulong) ) ], FFI.find_type(:cl_ulong).size * 16, FFI.find_type(:cl_ulong).size * 16 )
3366
- # Creates a new ULong16 with members set to 0 or to the user specified values
3248
+ class ULong16 < Struct
3249
+ @size = OpenCL.find_type(:cl_ulong).size * 16
3250
+ @layout = OpenCL::StructLayout::new([ OpenCL::StructLayout::Field::new( "s0", OpenCL.find_type(:cl_ulong).size * 0, OpenCL.find_type(:cl_ulong) ), OpenCL::StructLayout::Field::new( "s1", OpenCL.find_type(:cl_ulong).size * 1, OpenCL.find_type(:cl_ulong) ), OpenCL::StructLayout::Field::new( "s2", OpenCL.find_type(:cl_ulong).size * 2, OpenCL.find_type(:cl_ulong) ), OpenCL::StructLayout::Field::new( "s3", OpenCL.find_type(:cl_ulong).size * 3, OpenCL.find_type(:cl_ulong) ), OpenCL::StructLayout::Field::new( "s4", OpenCL.find_type(:cl_ulong).size * 4, OpenCL.find_type(:cl_ulong) ), OpenCL::StructLayout::Field::new( "s5", OpenCL.find_type(:cl_ulong).size * 5, OpenCL.find_type(:cl_ulong) ), OpenCL::StructLayout::Field::new( "s6", OpenCL.find_type(:cl_ulong).size * 6, OpenCL.find_type(:cl_ulong) ), OpenCL::StructLayout::Field::new( "s7", OpenCL.find_type(:cl_ulong).size * 7, OpenCL.find_type(:cl_ulong) ), OpenCL::StructLayout::Field::new( "s8", OpenCL.find_type(:cl_ulong).size * 8, OpenCL.find_type(:cl_ulong) ), OpenCL::StructLayout::Field::new( "s9", OpenCL.find_type(:cl_ulong).size * 9, OpenCL.find_type(:cl_ulong) ), OpenCL::StructLayout::Field::new( "sa", OpenCL.find_type(:cl_ulong).size * 10, OpenCL.find_type(:cl_ulong) ), OpenCL::StructLayout::Field::new( "sb", OpenCL.find_type(:cl_ulong).size * 11, OpenCL.find_type(:cl_ulong) ), OpenCL::StructLayout::Field::new( "sc", OpenCL.find_type(:cl_ulong).size * 12, OpenCL.find_type(:cl_ulong) ), OpenCL::StructLayout::Field::new( "sd", OpenCL.find_type(:cl_ulong).size * 13, OpenCL.find_type(:cl_ulong) ), OpenCL::StructLayout::Field::new( "se", OpenCL.find_type(:cl_ulong).size * 14, OpenCL.find_type(:cl_ulong) ), OpenCL::StructLayout::Field::new( "sf", OpenCL.find_type(:cl_ulong).size * 15, OpenCL.find_type(:cl_ulong) ) ], OpenCL.find_type(:cl_ulong).size * 16, OpenCL.find_type(:cl_ulong).size * 16 )
3251
+ # Creates a new ULong16 with members set to 0 or to the user specified values. If a Pointer is passed as the first argument, ULong16 maps the memory pointed.
3367
3252
  def initialize( s0 = 0, s1 = 0, s2 = 0, s3 = 0, s4 = 0, s5 = 0, s6 = 0, s7 = 0, s8 = 0, s9 = 0, sa = 0, sb = 0, sc = 0, sd = 0, se = 0, sf = 0 )
3368
- super()
3369
- self[:s0] = s0
3370
- self[:s1] = s1
3371
- self[:s2] = s2
3372
- self[:s3] = s3
3373
- self[:s4] = s4
3374
- self[:s5] = s5
3375
- self[:s6] = s6
3376
- self[:s7] = s7
3377
- self[:s8] = s8
3378
- self[:s9] = s9
3379
- self[:sa] = sa
3380
- self[:sb] = sb
3381
- self[:sc] = sc
3382
- self[:sd] = sd
3383
- self[:se] = se
3384
- self[:sf] = sf
3253
+ if s0.is_a?(FFI::Pointer) then
3254
+ super(s0)
3255
+ else
3256
+ super()
3257
+ self[:s0] = s0
3258
+ self[:s1] = s1
3259
+ self[:s2] = s2
3260
+ self[:s3] = s3
3261
+ self[:s4] = s4
3262
+ self[:s5] = s5
3263
+ self[:s6] = s6
3264
+ self[:s7] = s7
3265
+ self[:s8] = s8
3266
+ self[:s9] = s9
3267
+ self[:sa] = sa
3268
+ self[:sb] = sb
3269
+ self[:sc] = sc
3270
+ self[:sd] = sd
3271
+ self[:se] = se
3272
+ self[:sf] = sf
3273
+ end
3385
3274
  end
3386
3275
  # Reads the s0 member
3387
3276
  def s0
@@ -3521,28 +3410,32 @@ module OpenCL
3521
3410
  end
3522
3411
  end
3523
3412
  # Maps the cl_float16 type of OpenCL
3524
- class Float16 < FFI::Struct
3525
- @size = FFI.find_type(:cl_float).size * 16
3526
- @layout = FFI::StructLayout::new([ FFI::StructLayout::Field::new( "s0", FFI.find_type(:cl_float).size * 0, FFI.find_type(:cl_float) ), FFI::StructLayout::Field::new( "s1", FFI.find_type(:cl_float).size * 1, FFI.find_type(:cl_float) ), FFI::StructLayout::Field::new( "s2", FFI.find_type(:cl_float).size * 2, FFI.find_type(:cl_float) ), FFI::StructLayout::Field::new( "s3", FFI.find_type(:cl_float).size * 3, FFI.find_type(:cl_float) ), FFI::StructLayout::Field::new( "s4", FFI.find_type(:cl_float).size * 4, FFI.find_type(:cl_float) ), FFI::StructLayout::Field::new( "s5", FFI.find_type(:cl_float).size * 5, FFI.find_type(:cl_float) ), FFI::StructLayout::Field::new( "s6", FFI.find_type(:cl_float).size * 6, FFI.find_type(:cl_float) ), FFI::StructLayout::Field::new( "s7", FFI.find_type(:cl_float).size * 7, FFI.find_type(:cl_float) ), FFI::StructLayout::Field::new( "s8", FFI.find_type(:cl_float).size * 8, FFI.find_type(:cl_float) ), FFI::StructLayout::Field::new( "s9", FFI.find_type(:cl_float).size * 9, FFI.find_type(:cl_float) ), FFI::StructLayout::Field::new( "sa", FFI.find_type(:cl_float).size * 10, FFI.find_type(:cl_float) ), FFI::StructLayout::Field::new( "sb", FFI.find_type(:cl_float).size * 11, FFI.find_type(:cl_float) ), FFI::StructLayout::Field::new( "sc", FFI.find_type(:cl_float).size * 12, FFI.find_type(:cl_float) ), FFI::StructLayout::Field::new( "sd", FFI.find_type(:cl_float).size * 13, FFI.find_type(:cl_float) ), FFI::StructLayout::Field::new( "se", FFI.find_type(:cl_float).size * 14, FFI.find_type(:cl_float) ), FFI::StructLayout::Field::new( "sf", FFI.find_type(:cl_float).size * 15, FFI.find_type(:cl_float) ) ], FFI.find_type(:cl_float).size * 16, FFI.find_type(:cl_float).size * 16 )
3527
- # Creates a new Float16 with members set to 0 or to the user specified values
3413
+ class Float16 < Struct
3414
+ @size = OpenCL.find_type(:cl_float).size * 16
3415
+ @layout = OpenCL::StructLayout::new([ OpenCL::StructLayout::Field::new( "s0", OpenCL.find_type(:cl_float).size * 0, OpenCL.find_type(:cl_float) ), OpenCL::StructLayout::Field::new( "s1", OpenCL.find_type(:cl_float).size * 1, OpenCL.find_type(:cl_float) ), OpenCL::StructLayout::Field::new( "s2", OpenCL.find_type(:cl_float).size * 2, OpenCL.find_type(:cl_float) ), OpenCL::StructLayout::Field::new( "s3", OpenCL.find_type(:cl_float).size * 3, OpenCL.find_type(:cl_float) ), OpenCL::StructLayout::Field::new( "s4", OpenCL.find_type(:cl_float).size * 4, OpenCL.find_type(:cl_float) ), OpenCL::StructLayout::Field::new( "s5", OpenCL.find_type(:cl_float).size * 5, OpenCL.find_type(:cl_float) ), OpenCL::StructLayout::Field::new( "s6", OpenCL.find_type(:cl_float).size * 6, OpenCL.find_type(:cl_float) ), OpenCL::StructLayout::Field::new( "s7", OpenCL.find_type(:cl_float).size * 7, OpenCL.find_type(:cl_float) ), OpenCL::StructLayout::Field::new( "s8", OpenCL.find_type(:cl_float).size * 8, OpenCL.find_type(:cl_float) ), OpenCL::StructLayout::Field::new( "s9", OpenCL.find_type(:cl_float).size * 9, OpenCL.find_type(:cl_float) ), OpenCL::StructLayout::Field::new( "sa", OpenCL.find_type(:cl_float).size * 10, OpenCL.find_type(:cl_float) ), OpenCL::StructLayout::Field::new( "sb", OpenCL.find_type(:cl_float).size * 11, OpenCL.find_type(:cl_float) ), OpenCL::StructLayout::Field::new( "sc", OpenCL.find_type(:cl_float).size * 12, OpenCL.find_type(:cl_float) ), OpenCL::StructLayout::Field::new( "sd", OpenCL.find_type(:cl_float).size * 13, OpenCL.find_type(:cl_float) ), OpenCL::StructLayout::Field::new( "se", OpenCL.find_type(:cl_float).size * 14, OpenCL.find_type(:cl_float) ), OpenCL::StructLayout::Field::new( "sf", OpenCL.find_type(:cl_float).size * 15, OpenCL.find_type(:cl_float) ) ], OpenCL.find_type(:cl_float).size * 16, OpenCL.find_type(:cl_float).size * 16 )
3416
+ # Creates a new Float16 with members set to 0 or to the user specified values. If a Pointer is passed as the first argument, Float16 maps the memory pointed.
3528
3417
  def initialize( s0 = 0.0, s1 = 0.0, s2 = 0.0, s3 = 0.0, s4 = 0.0, s5 = 0.0, s6 = 0.0, s7 = 0.0, s8 = 0.0, s9 = 0.0, sa = 0.0, sb = 0.0, sc = 0.0, sd = 0.0, se = 0.0, sf = 0.0 )
3529
- super()
3530
- self[:s0] = s0
3531
- self[:s1] = s1
3532
- self[:s2] = s2
3533
- self[:s3] = s3
3534
- self[:s4] = s4
3535
- self[:s5] = s5
3536
- self[:s6] = s6
3537
- self[:s7] = s7
3538
- self[:s8] = s8
3539
- self[:s9] = s9
3540
- self[:sa] = sa
3541
- self[:sb] = sb
3542
- self[:sc] = sc
3543
- self[:sd] = sd
3544
- self[:se] = se
3545
- self[:sf] = sf
3418
+ if s0.is_a?(FFI::Pointer) then
3419
+ super(s0)
3420
+ else
3421
+ super()
3422
+ self[:s0] = s0
3423
+ self[:s1] = s1
3424
+ self[:s2] = s2
3425
+ self[:s3] = s3
3426
+ self[:s4] = s4
3427
+ self[:s5] = s5
3428
+ self[:s6] = s6
3429
+ self[:s7] = s7
3430
+ self[:s8] = s8
3431
+ self[:s9] = s9
3432
+ self[:sa] = sa
3433
+ self[:sb] = sb
3434
+ self[:sc] = sc
3435
+ self[:sd] = sd
3436
+ self[:se] = se
3437
+ self[:sf] = sf
3438
+ end
3546
3439
  end
3547
3440
  # Reads the s0 member
3548
3441
  def s0
@@ -3682,28 +3575,32 @@ module OpenCL
3682
3575
  end
3683
3576
  end
3684
3577
  # Maps the cl_double16 type of OpenCL
3685
- class Double16 < FFI::Struct
3686
- @size = FFI.find_type(:cl_double).size * 16
3687
- @layout = FFI::StructLayout::new([ FFI::StructLayout::Field::new( "s0", FFI.find_type(:cl_double).size * 0, FFI.find_type(:cl_double) ), FFI::StructLayout::Field::new( "s1", FFI.find_type(:cl_double).size * 1, FFI.find_type(:cl_double) ), FFI::StructLayout::Field::new( "s2", FFI.find_type(:cl_double).size * 2, FFI.find_type(:cl_double) ), FFI::StructLayout::Field::new( "s3", FFI.find_type(:cl_double).size * 3, FFI.find_type(:cl_double) ), FFI::StructLayout::Field::new( "s4", FFI.find_type(:cl_double).size * 4, FFI.find_type(:cl_double) ), FFI::StructLayout::Field::new( "s5", FFI.find_type(:cl_double).size * 5, FFI.find_type(:cl_double) ), FFI::StructLayout::Field::new( "s6", FFI.find_type(:cl_double).size * 6, FFI.find_type(:cl_double) ), FFI::StructLayout::Field::new( "s7", FFI.find_type(:cl_double).size * 7, FFI.find_type(:cl_double) ), FFI::StructLayout::Field::new( "s8", FFI.find_type(:cl_double).size * 8, FFI.find_type(:cl_double) ), FFI::StructLayout::Field::new( "s9", FFI.find_type(:cl_double).size * 9, FFI.find_type(:cl_double) ), FFI::StructLayout::Field::new( "sa", FFI.find_type(:cl_double).size * 10, FFI.find_type(:cl_double) ), FFI::StructLayout::Field::new( "sb", FFI.find_type(:cl_double).size * 11, FFI.find_type(:cl_double) ), FFI::StructLayout::Field::new( "sc", FFI.find_type(:cl_double).size * 12, FFI.find_type(:cl_double) ), FFI::StructLayout::Field::new( "sd", FFI.find_type(:cl_double).size * 13, FFI.find_type(:cl_double) ), FFI::StructLayout::Field::new( "se", FFI.find_type(:cl_double).size * 14, FFI.find_type(:cl_double) ), FFI::StructLayout::Field::new( "sf", FFI.find_type(:cl_double).size * 15, FFI.find_type(:cl_double) ) ], FFI.find_type(:cl_double).size * 16, FFI.find_type(:cl_double).size * 16 )
3688
- # Creates a new Double16 with members set to 0 or to the user specified values
3578
+ class Double16 < Struct
3579
+ @size = OpenCL.find_type(:cl_double).size * 16
3580
+ @layout = OpenCL::StructLayout::new([ OpenCL::StructLayout::Field::new( "s0", OpenCL.find_type(:cl_double).size * 0, OpenCL.find_type(:cl_double) ), OpenCL::StructLayout::Field::new( "s1", OpenCL.find_type(:cl_double).size * 1, OpenCL.find_type(:cl_double) ), OpenCL::StructLayout::Field::new( "s2", OpenCL.find_type(:cl_double).size * 2, OpenCL.find_type(:cl_double) ), OpenCL::StructLayout::Field::new( "s3", OpenCL.find_type(:cl_double).size * 3, OpenCL.find_type(:cl_double) ), OpenCL::StructLayout::Field::new( "s4", OpenCL.find_type(:cl_double).size * 4, OpenCL.find_type(:cl_double) ), OpenCL::StructLayout::Field::new( "s5", OpenCL.find_type(:cl_double).size * 5, OpenCL.find_type(:cl_double) ), OpenCL::StructLayout::Field::new( "s6", OpenCL.find_type(:cl_double).size * 6, OpenCL.find_type(:cl_double) ), OpenCL::StructLayout::Field::new( "s7", OpenCL.find_type(:cl_double).size * 7, OpenCL.find_type(:cl_double) ), OpenCL::StructLayout::Field::new( "s8", OpenCL.find_type(:cl_double).size * 8, OpenCL.find_type(:cl_double) ), OpenCL::StructLayout::Field::new( "s9", OpenCL.find_type(:cl_double).size * 9, OpenCL.find_type(:cl_double) ), OpenCL::StructLayout::Field::new( "sa", OpenCL.find_type(:cl_double).size * 10, OpenCL.find_type(:cl_double) ), OpenCL::StructLayout::Field::new( "sb", OpenCL.find_type(:cl_double).size * 11, OpenCL.find_type(:cl_double) ), OpenCL::StructLayout::Field::new( "sc", OpenCL.find_type(:cl_double).size * 12, OpenCL.find_type(:cl_double) ), OpenCL::StructLayout::Field::new( "sd", OpenCL.find_type(:cl_double).size * 13, OpenCL.find_type(:cl_double) ), OpenCL::StructLayout::Field::new( "se", OpenCL.find_type(:cl_double).size * 14, OpenCL.find_type(:cl_double) ), OpenCL::StructLayout::Field::new( "sf", OpenCL.find_type(:cl_double).size * 15, OpenCL.find_type(:cl_double) ) ], OpenCL.find_type(:cl_double).size * 16, OpenCL.find_type(:cl_double).size * 16 )
3581
+ # Creates a new Double16 with members set to 0 or to the user specified values. If a Pointer is passed as the first argument, Double16 maps the memory pointed.
3689
3582
  def initialize( s0 = 0.0, s1 = 0.0, s2 = 0.0, s3 = 0.0, s4 = 0.0, s5 = 0.0, s6 = 0.0, s7 = 0.0, s8 = 0.0, s9 = 0.0, sa = 0.0, sb = 0.0, sc = 0.0, sd = 0.0, se = 0.0, sf = 0.0 )
3690
- super()
3691
- self[:s0] = s0
3692
- self[:s1] = s1
3693
- self[:s2] = s2
3694
- self[:s3] = s3
3695
- self[:s4] = s4
3696
- self[:s5] = s5
3697
- self[:s6] = s6
3698
- self[:s7] = s7
3699
- self[:s8] = s8
3700
- self[:s9] = s9
3701
- self[:sa] = sa
3702
- self[:sb] = sb
3703
- self[:sc] = sc
3704
- self[:sd] = sd
3705
- self[:se] = se
3706
- self[:sf] = sf
3583
+ if s0.is_a?(FFI::Pointer) then
3584
+ super(s0)
3585
+ else
3586
+ super()
3587
+ self[:s0] = s0
3588
+ self[:s1] = s1
3589
+ self[:s2] = s2
3590
+ self[:s3] = s3
3591
+ self[:s4] = s4
3592
+ self[:s5] = s5
3593
+ self[:s6] = s6
3594
+ self[:s7] = s7
3595
+ self[:s8] = s8
3596
+ self[:s9] = s9
3597
+ self[:sa] = sa
3598
+ self[:sb] = sb
3599
+ self[:sc] = sc
3600
+ self[:sd] = sd
3601
+ self[:se] = se
3602
+ self[:sf] = sf
3603
+ end
3707
3604
  end
3708
3605
  # Reads the s0 member
3709
3606
  def s0
@@ -3843,28 +3740,32 @@ module OpenCL
3843
3740
  end
3844
3741
  end
3845
3742
  # Maps the cl_half16 type of OpenCL
3846
- class Half16 < FFI::Struct
3847
- @size = FFI.find_type(:cl_half).size * 16
3848
- @layout = FFI::StructLayout::new([ FFI::StructLayout::Field::new( "s0", FFI.find_type(:cl_half).size * 0, FFI.find_type(:cl_half) ), FFI::StructLayout::Field::new( "s1", FFI.find_type(:cl_half).size * 1, FFI.find_type(:cl_half) ), FFI::StructLayout::Field::new( "s2", FFI.find_type(:cl_half).size * 2, FFI.find_type(:cl_half) ), FFI::StructLayout::Field::new( "s3", FFI.find_type(:cl_half).size * 3, FFI.find_type(:cl_half) ), FFI::StructLayout::Field::new( "s4", FFI.find_type(:cl_half).size * 4, FFI.find_type(:cl_half) ), FFI::StructLayout::Field::new( "s5", FFI.find_type(:cl_half).size * 5, FFI.find_type(:cl_half) ), FFI::StructLayout::Field::new( "s6", FFI.find_type(:cl_half).size * 6, FFI.find_type(:cl_half) ), FFI::StructLayout::Field::new( "s7", FFI.find_type(:cl_half).size * 7, FFI.find_type(:cl_half) ), FFI::StructLayout::Field::new( "s8", FFI.find_type(:cl_half).size * 8, FFI.find_type(:cl_half) ), FFI::StructLayout::Field::new( "s9", FFI.find_type(:cl_half).size * 9, FFI.find_type(:cl_half) ), FFI::StructLayout::Field::new( "sa", FFI.find_type(:cl_half).size * 10, FFI.find_type(:cl_half) ), FFI::StructLayout::Field::new( "sb", FFI.find_type(:cl_half).size * 11, FFI.find_type(:cl_half) ), FFI::StructLayout::Field::new( "sc", FFI.find_type(:cl_half).size * 12, FFI.find_type(:cl_half) ), FFI::StructLayout::Field::new( "sd", FFI.find_type(:cl_half).size * 13, FFI.find_type(:cl_half) ), FFI::StructLayout::Field::new( "se", FFI.find_type(:cl_half).size * 14, FFI.find_type(:cl_half) ), FFI::StructLayout::Field::new( "sf", FFI.find_type(:cl_half).size * 15, FFI.find_type(:cl_half) ) ], FFI.find_type(:cl_half).size * 16, FFI.find_type(:cl_half).size * 16 )
3849
- # Creates a new Half16 with members set to 0 or to the user specified values
3743
+ class Half16 < Struct
3744
+ @size = OpenCL.find_type(:cl_half).size * 16
3745
+ @layout = OpenCL::StructLayout::new([ OpenCL::StructLayout::Field::new( "s0", OpenCL.find_type(:cl_half).size * 0, OpenCL.find_type(:cl_half) ), OpenCL::StructLayout::Field::new( "s1", OpenCL.find_type(:cl_half).size * 1, OpenCL.find_type(:cl_half) ), OpenCL::StructLayout::Field::new( "s2", OpenCL.find_type(:cl_half).size * 2, OpenCL.find_type(:cl_half) ), OpenCL::StructLayout::Field::new( "s3", OpenCL.find_type(:cl_half).size * 3, OpenCL.find_type(:cl_half) ), OpenCL::StructLayout::Field::new( "s4", OpenCL.find_type(:cl_half).size * 4, OpenCL.find_type(:cl_half) ), OpenCL::StructLayout::Field::new( "s5", OpenCL.find_type(:cl_half).size * 5, OpenCL.find_type(:cl_half) ), OpenCL::StructLayout::Field::new( "s6", OpenCL.find_type(:cl_half).size * 6, OpenCL.find_type(:cl_half) ), OpenCL::StructLayout::Field::new( "s7", OpenCL.find_type(:cl_half).size * 7, OpenCL.find_type(:cl_half) ), OpenCL::StructLayout::Field::new( "s8", OpenCL.find_type(:cl_half).size * 8, OpenCL.find_type(:cl_half) ), OpenCL::StructLayout::Field::new( "s9", OpenCL.find_type(:cl_half).size * 9, OpenCL.find_type(:cl_half) ), OpenCL::StructLayout::Field::new( "sa", OpenCL.find_type(:cl_half).size * 10, OpenCL.find_type(:cl_half) ), OpenCL::StructLayout::Field::new( "sb", OpenCL.find_type(:cl_half).size * 11, OpenCL.find_type(:cl_half) ), OpenCL::StructLayout::Field::new( "sc", OpenCL.find_type(:cl_half).size * 12, OpenCL.find_type(:cl_half) ), OpenCL::StructLayout::Field::new( "sd", OpenCL.find_type(:cl_half).size * 13, OpenCL.find_type(:cl_half) ), OpenCL::StructLayout::Field::new( "se", OpenCL.find_type(:cl_half).size * 14, OpenCL.find_type(:cl_half) ), OpenCL::StructLayout::Field::new( "sf", OpenCL.find_type(:cl_half).size * 15, OpenCL.find_type(:cl_half) ) ], OpenCL.find_type(:cl_half).size * 16, OpenCL.find_type(:cl_half).size * 16 )
3746
+ # Creates a new Half16 with members set to 0 or to the user specified values. If a Pointer is passed as the first argument, Half16 maps the memory pointed.
3850
3747
  def initialize( s0 = 0.0, s1 = 0.0, s2 = 0.0, s3 = 0.0, s4 = 0.0, s5 = 0.0, s6 = 0.0, s7 = 0.0, s8 = 0.0, s9 = 0.0, sa = 0.0, sb = 0.0, sc = 0.0, sd = 0.0, se = 0.0, sf = 0.0 )
3851
- super()
3852
- self[:s0] = s0
3853
- self[:s1] = s1
3854
- self[:s2] = s2
3855
- self[:s3] = s3
3856
- self[:s4] = s4
3857
- self[:s5] = s5
3858
- self[:s6] = s6
3859
- self[:s7] = s7
3860
- self[:s8] = s8
3861
- self[:s9] = s9
3862
- self[:sa] = sa
3863
- self[:sb] = sb
3864
- self[:sc] = sc
3865
- self[:sd] = sd
3866
- self[:se] = se
3867
- self[:sf] = sf
3748
+ if s0.is_a?(FFI::Pointer) then
3749
+ super(s0)
3750
+ else
3751
+ super()
3752
+ self[:s0] = s0
3753
+ self[:s1] = s1
3754
+ self[:s2] = s2
3755
+ self[:s3] = s3
3756
+ self[:s4] = s4
3757
+ self[:s5] = s5
3758
+ self[:s6] = s6
3759
+ self[:s7] = s7
3760
+ self[:s8] = s8
3761
+ self[:s9] = s9
3762
+ self[:sa] = sa
3763
+ self[:sb] = sb
3764
+ self[:sc] = sc
3765
+ self[:sd] = sd
3766
+ self[:se] = se
3767
+ self[:sf] = sf
3768
+ end
3868
3769
  end
3869
3770
  # Reads the s0 member
3870
3771
  def s0