3838 index* : uint64
3939 slot* : Slot
4040 count* : uint64
41- step* : uint64
4241 item* : T
4342
4443 SyncResult * [T] = object
@@ -105,12 +104,12 @@ proc getShortMap*[T](req: SyncRequest[T],
105104 break
106105 else :
107106 res.add ('.' )
108- slider = slider + req.step
107+ slider = slider + 1
109108 res
110109
111110proc contains * [T](req: SyncRequest [T], slot: Slot ): bool {.inline .} =
112- slot >= req.slot and slot < req.slot + req.count * req.step and
113- ((slot - req.slot) mod req.step == 0 )
111+ slot >= req.slot and slot < req.slot + req.count and
112+ ((slot - req.slot) == 0 )
114113
115114proc cmp * [T](a, b: SyncRequest [T]): int =
116115 cmp (uint64 (a.slot), uint64 (b.slot))
@@ -137,7 +136,7 @@ proc checkResponse*[T](req: SyncRequest[T],
137136 inc (dindex)
138137 else :
139138 return false
140- slot = slot + req.step
139+ slot = slot + 1
141140 rindex = rindex + 1 'u64
142141
143142 if dindex == len (data):
@@ -153,26 +152,26 @@ proc getFullMap*[T](req: SyncRequest[T],
153152proc init [T](t1: typedesc [SyncRequest ], kind: SyncQueueKind , start: Slot ,
154153 finish: Slot , t2: typedesc [T]): SyncRequest [T] =
155154 let count = finish - start + 1 'u64
156- SyncRequest [T](kind: kind, slot: start, count: count, step: 1 'u64 )
155+ SyncRequest [T](kind: kind, slot: start, count: count)
157156
158157proc init [T](t1: typedesc [SyncRequest ], kind: SyncQueueKind , slot: Slot ,
159158 count: uint64 , item: T): SyncRequest [T] =
160- SyncRequest [T](kind: kind, slot: slot, count: count, item: item, step: 1 'u64 )
159+ SyncRequest [T](kind: kind, slot: slot, count: count, item: item)
161160
162161proc init [T](t1: typedesc [SyncRequest ], kind: SyncQueueKind , start: Slot ,
163162 finish: Slot , item: T): SyncRequest [T] =
164163 let count = finish - start + 1 'u64
165- SyncRequest [T](kind: kind, slot: start, count: count, step: 1 'u64 , item: item)
164+ SyncRequest [T](kind: kind, slot: start, count: count, item: item)
166165
167166proc empty * [T](t: typedesc [SyncRequest ], kind: SyncQueueKind ,
168167 t2: typedesc [T]): SyncRequest [T] {.inline .} =
169- SyncRequest [T](kind: kind, step: 0 'u64 , count: 0 'u64 )
168+ SyncRequest [T](kind: kind, count: 0 'u64 )
170169
171170proc setItem * [T](sr: var SyncRequest [T], item: T) =
172171 sr.item = item
173172
174173proc isEmpty * [T](sr: SyncRequest [T]): bool {.inline .} =
175- (sr.step == 0 'u64 ) and (sr. count == 0 'u64 )
174+ (sr.count == 0 'u64 )
176175
177176proc init * [T](t1: typedesc [SyncQueue ], t2: typedesc [T],
178177 queueKind: SyncQueueKind ,
@@ -263,8 +262,7 @@ proc `<`*[T](a, b: SyncResult[T]): bool =
263262 a.request.slot > b.request.slot
264263
265264proc `==` * [T](a, b: SyncRequest [T]): bool =
266- (a.kind == b.kind) and (a.slot == b.slot) and (a.count == b.count) and
267- (a.step == b.step)
265+ (a.kind == b.kind) and (a.slot == b.slot) and (a.count == b.count)
268266
269267proc lastSlot * [T](req: SyncRequest [T]): Slot =
270268 # # Returns last slot for request ``req``.
@@ -808,12 +806,10 @@ func updateRequestForNewSafeSlot[T](sq: SyncQueue[T], sr: var SyncRequest[T]) =
808806 # Request is only partially relevant.
809807 let
810808 numSlotsDone = outSlot - lowSlot
811- numStepsDone = (numSlotsDone + sr.step - 1 ) div sr.step
812- sr.slot += numStepsDone * sr.step
813- sr.count -= numStepsDone
809+ sr.slot += numSlotsDone
810+ sr.count -= numSlotsDone
814811 else :
815812 # Entire request is no longer relevant.
816- sr.step = 0
817813 sr.count = 0
818814 of SyncQueueKind .Backward :
819815 if outSlot >= highSlot:
@@ -823,11 +819,9 @@ func updateRequestForNewSafeSlot[T](sq: SyncQueue[T], sr: var SyncRequest[T]) =
823819 # Request is only partially relevant.
824820 let
825821 numSlotsDone = highSlot - outSlot
826- numStepsDone = (numSlotsDone + sr.step - 1 ) div sr.step
827- sr.count -= numStepsDone
822+ sr.count -= numSlotsDone
828823 else :
829824 # Entire request is no longer relevant.
830- sr.step = 0
831825 sr.count = 0
832826
833827proc pop * [T](sq: SyncQueue [T], maxslot: Slot , item: T): SyncRequest [T] =
0 commit comments