@@ -109,9 +109,8 @@ pub unsafe trait FloatScalar:
109109}
110110
111111/// Integer scalar types.
112- pub trait IntScalar :
113- Scalar < Vec2 : bindings:: IntegerVector , Vec3 : bindings:: IntegerVector , Vec4 : bindings:: IntegerVector >
114- {
112+ pub trait IntScalar : Scalar + num_traits:: PrimInt {
113+ type Unsigned : IntScalar + num_traits:: Unsigned ;
115114}
116115
117116unsafe impl Scalar for f32 {
@@ -160,7 +159,9 @@ unsafe impl Scalar for i16 {
160159 type Vec4 = glam:: I16Vec4 ;
161160}
162161
163- impl IntScalar for i16 { }
162+ impl IntScalar for i16 {
163+ type Unsigned = u16 ;
164+ }
164165
165166impl SignedScalar for i16 {
166167 const NEG_ONE : Self = -1 ;
@@ -172,7 +173,9 @@ unsafe impl Scalar for i32 {
172173 type Vec4 = glam:: IVec4 ;
173174}
174175
175- impl IntScalar for i32 { }
176+ impl IntScalar for i32 {
177+ type Unsigned = u32 ;
178+ }
176179
177180impl SignedScalar for i32 {
178181 const NEG_ONE : Self = -1 ;
@@ -184,7 +187,9 @@ unsafe impl Scalar for i64 {
184187 type Vec4 = glam:: I64Vec4 ;
185188}
186189
187- impl IntScalar for i64 { }
190+ impl IntScalar for i64 {
191+ type Unsigned = u64 ;
192+ }
188193
189194impl SignedScalar for i64 {
190195 const NEG_ONE : Self = -1 ;
@@ -196,23 +201,29 @@ unsafe impl Scalar for u16 {
196201 type Vec4 = glam:: U16Vec4 ;
197202}
198203
199- impl IntScalar for u16 { }
204+ impl IntScalar for u16 {
205+ type Unsigned = u16 ;
206+ }
200207
201208unsafe impl Scalar for u32 {
202209 type Vec2 = glam:: UVec2 ;
203210 type Vec3 = glam:: UVec3 ;
204211 type Vec4 = glam:: UVec4 ;
205212}
206213
207- impl IntScalar for u32 { }
214+ impl IntScalar for u32 {
215+ type Unsigned = u32 ;
216+ }
208217
209218unsafe impl Scalar for u64 {
210219 type Vec2 = glam:: U64Vec2 ;
211220 type Vec3 = glam:: U64Vec3 ;
212221 type Vec4 = glam:: U64Vec4 ;
213222}
214223
215- impl IntScalar for u64 { }
224+ impl IntScalar for u64 {
225+ type Unsigned = u64 ;
226+ }
216227
217228#[ cfg( test) ]
218229mod tests {
0 commit comments