Skip to main content
. 2023 Jan 10;23(2):819. doi: 10.3390/s23020819
Algorithm 3 Procedure to insert a new packet Uj and release a packet concurrently.

   Release S1 to output and insert packet Uj in pipeline

   if Cexp==S1 and Uj arrives

       Find k such that Si<Us for 1≤i≤k−1, and Si>Us for i≥k

       Obuf←S1

       for 1<i≤k−1 in parallel

          Pi−1←Pi; Pk−1←Uj                  ▹ Shift P2 to Pk−1 to the left; Insert Uj at Pk−1

          Cexp++                                                   ▹ Increment expected in-sequence counter