|
11 | 11 | //===----------------------------------------------------------------------===// |
12 | 12 |
|
13 | 13 | %{ |
| 14 | +from __future__ import division |
14 | 15 | from SwiftIntTypes import all_integer_types |
15 | 16 | word_bits = int(CMAKE_SIZEOF_VOID_P) * 8 |
16 | 17 | storagescalarCounts = [2,4,8,16,32,64] |
@@ -90,17 +91,17 @@ public struct SIMD${n}<Scalar>: SIMD where Scalar: SIMDScalar { |
90 | 91 | % if n >= 4: |
91 | 92 | /// Creates a new vector from two half-length vectors. |
92 | 93 | @_transparent |
93 | | - public init(lowHalf: SIMD${n/2}<Scalar>, highHalf: SIMD${n/2}<Scalar>) { |
| 94 | + public init(lowHalf: SIMD${n//2}<Scalar>, highHalf: SIMD${n//2}<Scalar>) { |
94 | 95 | self.init() |
95 | 96 | self.lowHalf = lowHalf |
96 | 97 | self.highHalf = highHalf |
97 | 98 | } |
98 | 99 |
|
99 | | -% for (half,indx) in [('low','i'), ('high',str(n/2)+'+i'), ('even','2*i'), ('odd','2*i+1')]: |
| 100 | +% for (half,indx) in [('low','i'), ('high',str(n//2)+'+i'), ('even','2*i'), ('odd','2*i+1')]: |
100 | 101 | /// A half-length vector made up of the ${half} elements of the vector. |
101 | | - public var ${half}Half: SIMD${n/2}<Scalar> { |
| 102 | + public var ${half}Half: SIMD${n//2}<Scalar> { |
102 | 103 | @inlinable get { |
103 | | - var result = SIMD${n/2}<Scalar>() |
| 104 | + var result = SIMD${n//2}<Scalar>() |
104 | 105 | for i in result.indices { result[i] = self[${indx}] } |
105 | 106 | return result |
106 | 107 | } |
@@ -159,7 +160,7 @@ extension SIMD${n}: CustomDebugStringConvertible { |
159 | 160 | public var debugDescription: String { |
160 | 161 | return "SIMD${n}<\(Scalar.self)>(${', '.join(map(lambda c: |
161 | 162 | '\\(self['+ str(c) + '])', |
162 | | - xrange(n)))})" |
| 163 | + range(n)))})" |
163 | 164 | } |
164 | 165 | } |
165 | 166 |
|
@@ -212,7 +213,7 @@ extension ${Self}: SIMDScalar { |
212 | 213 | public typealias SIMDMaskScalar = ${Mask} |
213 | 214 |
|
214 | 215 | % for n in storagescalarCounts: |
215 | | -% bytes = n * self_type.bits / 8 |
| 216 | +% bytes = n * self_type.bits // 8 |
216 | 217 | /// Storage for a vector of ${spelledNumbers[n]} integers. |
217 | 218 | @frozen |
218 | 219 | @_alignment(${bytes if bytes <= 16 else 16}) |
@@ -260,7 +261,7 @@ extension ${Self} : SIMDScalar { |
260 | 261 | public typealias SIMDMaskScalar = Int${bits} |
261 | 262 |
|
262 | 263 | % for n in storagescalarCounts: |
263 | | -% bytes = n * bits / 8 |
| 264 | +% bytes = n * bits // 8 |
264 | 265 | /// Storage for a vector of ${spelledNumbers[n]} floating-point values. |
265 | 266 | @frozen |
266 | 267 | @_alignment(${bytes if bytes <= 16 else 16}) |
|
0 commit comments