A minimal example would be more beneficial:
Say I have a sorted 8 ints = {10, 20, 30, 40, 50, 60, 70, 80}
(My use case is for sorted integers but i am not sure if that information is valuable considering vector instruction act on the entire dataset)
There are few operations required:
- Insert and shift.
-> insert 25 at it's sorted location. -> becomes insert 25 at index 2 and shift rest.
10, 20, 30, 40, 50, 60, 70, 80
becomes: 10, 20, 25, 30, 40, 50, 60, 70
- Remove and shift
-> remove 20 from the array
10, 20, 30, 40, 50, 60, 70, 80
becomes 10, 30, 40, 50, 60, 70, 0
Or would a set of instructions make it work?
I am trying the insert and shift part with multiple steps for a descending sorted array. https://godbolt.org/z/_WCxkW