@@ -190,9 +190,9 @@ pub struct SamplingContext {
190
190
animation_id : u64 ,
191
191
ratio : f32 ,
192
192
193
- translation_cursor : usize ,
194
- rotation_cursor : usize ,
195
- scale_cursor : usize ,
193
+ translation_cursor : u32 ,
194
+ rotation_cursor : u32 ,
195
+ scale_cursor : u32 ,
196
196
}
197
197
198
198
unsafe impl Send for SamplingContext { }
@@ -517,19 +517,19 @@ impl SamplingContext {
517
517
/// Current cursors in the animation. 0 means that the context is invalid.
518
518
#[ inline]
519
519
pub fn translation_cursor ( & self ) -> usize {
520
- return self . translation_cursor ;
520
+ return self . translation_cursor as usize ;
521
521
}
522
522
523
523
/// Current cursors in the animation. 0 means that the context is invalid.
524
524
#[ inline]
525
525
pub fn rotation_cursor ( & self ) -> usize {
526
- return self . rotation_cursor ;
526
+ return self . rotation_cursor as usize ;
527
527
}
528
528
529
529
/// Current cursors in the animation. 0 means that the context is invalid.
530
530
#[ inline]
531
531
pub fn scale_cursor ( & self ) -> usize {
532
- return self . scale_cursor ;
532
+ return self . scale_cursor as usize ;
533
533
}
534
534
}
535
535
@@ -654,11 +654,11 @@ const _: () = {
654
654
RelPtr :: emplace ( pos + fp, resolver. scale_keys_pos , fo) ;
655
655
656
656
let ( fp, fo) = out_field ! ( out. translation_cursor) ;
657
- usize :: resolve ( & self . translation_cursor , pos + fp, ( ) , fo) ;
657
+ u32 :: resolve ( & self . translation_cursor , pos + fp, ( ) , fo) ;
658
658
let ( fp, fo) = out_field ! ( out. rotation_cursor) ;
659
- usize :: resolve ( & self . rotation_cursor , pos + fp, ( ) , fo) ;
659
+ u32 :: resolve ( & self . rotation_cursor , pos + fp, ( ) , fo) ;
660
660
let ( fp, fo) = out_field ! ( out. scale_cursor) ;
661
- usize :: resolve ( & self . scale_cursor , pos + fp, ( ) , fo) ;
661
+ u32 :: resolve ( & self . scale_cursor , pos + fp, ( ) , fo) ;
662
662
663
663
let ( fp, fo) = out_field ! ( out. outdated_translations_ptr) ;
664
664
RelPtr :: emplace ( pos + fp, resolver. outdated_translations_pos , fo) ;
@@ -744,9 +744,9 @@ const _: () = {
744
744
. copy_from_slice ( archived. translation_keys ( ) ) ;
745
745
context. rotation_keys_mut ( ) . copy_from_slice ( archived. rotation_keys ( ) ) ;
746
746
context. scale_keys_mut ( ) . copy_from_slice ( archived. scale_keys ( ) ) ;
747
- context. translation_cursor = archived. translation_cursor as usize ;
748
- context. rotation_cursor = archived. rotation_cursor as usize ;
749
- context. scale_cursor = archived. scale_cursor as usize ;
747
+ context. translation_cursor = archived. translation_cursor ;
748
+ context. rotation_cursor = archived. rotation_cursor ;
749
+ context. scale_cursor = archived. scale_cursor ;
750
750
context
751
751
. outdated_translations_mut ( )
752
752
. copy_from_slice ( archived. outdated_translations ( ) ) ;
@@ -1132,19 +1132,19 @@ where
1132
1132
. last_mut ( )
1133
1133
. map ( |x| * x = 0xFF >> last_offset) ;
1134
1134
1135
- ctx. translation_cursor = animation. num_aligned_tracks ( ) * 2 ;
1135
+ ctx. translation_cursor = ( animation. num_aligned_tracks ( ) as u32 ) * 2 ;
1136
1136
}
1137
1137
1138
- while ctx. translation_cursor < animation. translations ( ) . len ( ) {
1139
- let track = animation. translations ( ) [ ctx. translation_cursor ] . track as usize ;
1138
+ while ctx. translation_cursor ( ) < animation. translations ( ) . len ( ) {
1139
+ let track = animation. translations ( ) [ ctx. translation_cursor ( ) ] . track as usize ;
1140
1140
let key_idx = ctx. translation_keys ( ) [ track * 2 + 1 ] as usize ;
1141
1141
let ani_ratio = animation. translations ( ) [ key_idx] . ratio ;
1142
1142
if ani_ratio > ratio {
1143
1143
break ;
1144
1144
}
1145
1145
1146
1146
ctx. outdated_translations_mut ( ) [ track / 32 ] |= 1 << ( ( track & 0x1F ) / 4 ) ;
1147
- let base = ( animation. translations ( ) [ ctx. translation_cursor ] . track as usize ) * 2 ;
1147
+ let base = ( animation. translations ( ) [ ctx. translation_cursor ( ) ] . track as usize ) * 2 ;
1148
1148
ctx. translation_keys_mut ( ) [ base] = ctx. translation_keys ( ) [ base + 1 ] ;
1149
1149
ctx. translation_keys_mut ( ) [ base + 1 ] = ctx. translation_cursor as i32 ;
1150
1150
ctx. translation_cursor = ctx. translation_cursor + 1 ;
@@ -1202,19 +1202,19 @@ where
1202
1202
. last_mut ( )
1203
1203
. map ( |x| * x = 0xFF >> last_offset) ;
1204
1204
1205
- ctx. rotation_cursor = animation. num_aligned_tracks ( ) * 2 ;
1205
+ ctx. rotation_cursor = ( animation. num_aligned_tracks ( ) as u32 ) * 2 ;
1206
1206
}
1207
1207
1208
- while ctx. rotation_cursor < animation. rotations ( ) . len ( ) {
1209
- let track = animation. rotations ( ) [ ctx. rotation_cursor ] . track ( ) as usize ;
1208
+ while ctx. rotation_cursor ( ) < animation. rotations ( ) . len ( ) {
1209
+ let track = animation. rotations ( ) [ ctx. rotation_cursor ( ) ] . track ( ) as usize ;
1210
1210
let key_idx = ctx. rotation_keys ( ) [ track * 2 + 1 ] as usize ;
1211
1211
let ani_ratio = animation. rotations ( ) [ key_idx] . ratio ;
1212
1212
if ani_ratio > ratio {
1213
1213
break ;
1214
1214
}
1215
1215
1216
1216
ctx. outdated_rotations_mut ( ) [ track / 32 ] |= 1 << ( ( track & 0x1F ) / 4 ) ;
1217
- let base = ( animation. rotations ( ) [ ctx. rotation_cursor ] . track ( ) as usize ) * 2 ;
1217
+ let base = ( animation. rotations ( ) [ ctx. rotation_cursor ( ) ] . track ( ) as usize ) * 2 ;
1218
1218
ctx. rotation_keys_mut ( ) [ base] = ctx. rotation_keys ( ) [ base + 1 ] ;
1219
1219
ctx. rotation_keys_mut ( ) [ base + 1 ] = ctx. rotation_cursor as i32 ;
1220
1220
ctx. rotation_cursor = ctx. rotation_cursor + 1 ;
@@ -1270,19 +1270,19 @@ where
1270
1270
let last_offset = ( ( animation. num_soa_tracks ( ) + 7 ) / 8 * 8 ) - animation. num_soa_tracks ( ) ;
1271
1271
ctx. outdated_scales_mut ( ) . last_mut ( ) . map ( |x| * x = 0xFF >> last_offset) ;
1272
1272
1273
- ctx. scale_cursor = animation. num_aligned_tracks ( ) * 2 ;
1273
+ ctx. scale_cursor = ( animation. num_aligned_tracks ( ) as u32 ) * 2 ;
1274
1274
}
1275
1275
1276
- while ctx. scale_cursor < animation. scales ( ) . len ( ) {
1277
- let track = animation. scales ( ) [ ctx. scale_cursor ] . track as usize ;
1276
+ while ctx. scale_cursor ( ) < animation. scales ( ) . len ( ) {
1277
+ let track = animation. scales ( ) [ ctx. scale_cursor ( ) ] . track as usize ;
1278
1278
let key_idx = ctx. scale_keys ( ) [ track * 2 + 1 ] as usize ;
1279
1279
let ani_ratio = animation. scales ( ) [ key_idx] . ratio ;
1280
1280
if ani_ratio > ratio {
1281
1281
break ;
1282
1282
}
1283
1283
1284
1284
ctx. outdated_scales_mut ( ) [ track / 32 ] |= 1 << ( ( track & 0x1F ) / 4 ) ;
1285
- let base = ( animation. scales ( ) [ ctx. scale_cursor ] . track as usize ) * 2 ;
1285
+ let base = ( animation. scales ( ) [ ctx. scale_cursor ( ) ] . track as usize ) * 2 ;
1286
1286
ctx. scale_keys_mut ( ) [ base] = ctx. scale_keys ( ) [ base + 1 ] ;
1287
1287
ctx. scale_keys_mut ( ) [ base + 1 ] = ctx. scale_cursor as i32 ;
1288
1288
ctx. scale_cursor = ctx. scale_cursor + 1 ;
@@ -1794,9 +1794,9 @@ mod sampling_tests {
1794
1794
assert_eq ! ( archived. size as usize , ctx. size( ) ) ;
1795
1795
assert_eq ! ( archived. animation_id, ctx. animation_id) ;
1796
1796
assert_eq ! ( archived. ratio, ctx. ratio) ;
1797
- assert_eq ! ( archived. translation_cursor as usize , ctx. translation_cursor) ;
1798
- assert_eq ! ( archived. rotation_cursor as usize , ctx. rotation_cursor) ;
1799
- assert_eq ! ( archived. scale_cursor as usize , ctx. scale_cursor) ;
1797
+ assert_eq ! ( archived. translation_cursor, ctx. translation_cursor) ;
1798
+ assert_eq ! ( archived. rotation_cursor, ctx. rotation_cursor) ;
1799
+ assert_eq ! ( archived. scale_cursor, ctx. scale_cursor) ;
1800
1800
unsafe {
1801
1801
assert_eq ! ( archived. translations( ) , ctx. translations( ) ) ;
1802
1802
assert_eq ! ( archived. rotations( ) , ctx. rotations( ) ) ;
0 commit comments