Skip to content

[API Proposoal]: Additional methods for "DotNext.Span" #193

@CodingMadness

Description

@CodingMadness

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!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

Status

Closed

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions