MCPcopy
hub / github.com/robfig/cron / getBits

Function getBits

parser.go:344–357  ·  parser.go::getBits

getBits sets all bits in the range [min, max], modulo the given step size.

(min, max, step uint)

Source from the content-addressed store, hash-verified

342
343// getBits sets all bits in the range [min, max], modulo the given step size.
344func getBits(min, max, step uint) uint64 {
345 var bits uint64
346
347 // If step is 1, use shifts.
348 if step == 1 {
349 return ^(math.MaxUint64 << (max + 1)) & (math.MaxUint64 << min)
350 }
351
352 // Else, use a simple loop.
353 for i := min; i <= max; i += step {
354 bits |= 1 << i
355 }
356 return bits
357}
358
359// all returns all bits within the given bounds. (plus the star bit)
360func all(r bounds) uint64 {

Callers 3

TestBitsFunction · 0.85
getRangeFunction · 0.85
allFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestBitsFunction · 0.68