MCPcopy Create free account
hub / github.com/arcjet/gravity / inclusiveStep

Function inclusiveStep

examples/instructions/instructions_test.go:28–46  ·  view source on GitHub ↗
(start Num, end Num, step Num)

Source from the content-addressed store, hash-verified

26 }
27}
28func inclusiveStep[Num interface{ ~int32 | ~uint32 }](start Num, end Num, step Num) iter.Seq[Num] {
29 return func(yield func(v Num) bool) {
30 var next Num = start
31 for {
32 if !yield(next) {
33 return
34 }
35 if next == end {
36 return
37 }
38
39 if end-step > next {
40 next += step
41 } else {
42 next = end
43 }
44 }
45 }
46}
47
48func Test_S8Roundtrip(t *testing.T) {
49 fac, err := NewInstructionsFactory(t.Context())

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected