for i := 0; i < 8; i++ {
buf = (buf << 8) | uint64(bitMap[i])
}
这是语法糖么?
之前看到一个开源库中的代码,自己看的就有些迷茫:
```go
// dayMatches returns true if the schedule's day-of-week and day-of-month
// restrictions are satisfied by the given time.
func dayMatches(s *SpecSchedule, t time.Time) bool {
var (
domMatch bool = 1<<uint(t.Day())&s.Dom > 0
dowMatch bool = 1<<uint(t.Weekday())&s.Dow > 0
)
if s.Dom&starBit > 0 || s.Dow&starBit > 0 {
return domMatch && dowMatch
}
return domMatch || dowMatch
}
```
![屏幕快照 2019-08-23 上午11.07.55.png](https://static.studygolang.com/190823/c388f5ad4885ac0fdf8b9b7441ef69df.png)
#8
更多评论