Heyo,
I have written some "SpanExtension" methods cause its needed to be optimized for rendering logic and I thought maybe they could go inside your DotNext.Span namespace :)
I will post a github gist "Utils" class where i hord those functions needed for my 2D game.
This gist contains 3 core methods:
-
span.MoveBy(Range, int) ---------> moves a specified range within the span by a value in either LEFT or RIGHT direction
0 > value = left direction;
0 < value = rigth direction;
-
span.Move2(Range, int) ---------> moves a specified range within the span to a specific index
-
span.Swap(this ROS self, ROS x, ROS y); ---------> swaps 2 slices from the same span
without extra heapbased copies.
The other 2 methods are just, 1 for simple (not fully fledged tests, did not have time for it yet..) and the other is just a direct wrapping function of Swap(...) to work easier with ROS-types.
this gist here contains the "SpanInfo" type building all the nessecary information pre-hand, so its easier to control what is needed and when to cuse them, debloats heavily the Swap() function
I really hope that you have a look upon them and tell me if they are useful and when not, also tell me pls why ^^
All good 2 you and ur family and really really nice job you did with DotNext!
Cheers!
Heyo,
I have written some "SpanExtension" methods cause its needed to be optimized for rendering logic and I thought maybe they could go inside your DotNext.Span namespace :)
I will post a github gist "Utils" class where i hord those functions needed for my 2D game.
This gist contains 3 core methods:
span.MoveBy(Range, int) ---------> moves a specified range within the span by a value in either LEFT or RIGHT direction
0 > value = left direction;
0 < value = rigth direction;
span.Move2(Range, int) ---------> moves a specified range within the span to a specific index
span.Swap(this ROS self, ROS x, ROS y); ---------> swaps 2 slices from the same span
without extra heapbased copies.
The other 2 methods are just, 1 for simple (not fully fledged tests, did not have time for it yet..) and the other is just a direct wrapping function of Swap(...) to work easier with ROS-types.
this gist here contains the "SpanInfo" type building all the nessecary information pre-hand, so its easier to control what is needed and when to cuse them, debloats heavily the Swap() function
I really hope that you have a look upon them and tell me if they are useful and when not, also tell me pls why ^^
All good 2 you and ur family and really really nice job you did with DotNext!
Cheers!