1. 首页
  2. 主题
  3. Go问与答

哪位解答下 for 循环里面的语句展开的意思是啥

ccoding · · 1524 次点击
for i := 0; i < 8; i++ { buf = (buf << 8) | uint64(bitMap[i]) } 这是语法糖么?
stayfoo
stay hungry stay foolish
之前看到一个开源库中的代码,自己看的就有些迷茫: ```go // dayMatches returns true if the schedule&#39;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&lt;&lt;uint(t.Day())&amp;s.Dom &gt; 0 dowMatch bool = 1&lt;&lt;uint(t.Weekday())&amp;s.Dow &gt; 0 ) if s.Dom&amp;starBit &gt; 0 || s.Dow&amp;starBit &gt; 0 { return domMatch &amp;&amp; dowMatch } return domMatch || dowMatch } ``` ![屏幕快照 2019年08月23日 上午11.07.55.png](https://static.studygolang.com/190823/c388f5ad4885ac0fdf8b9b7441ef69df.png)
#8
更多评论
这不是给buf赋值吗,你这给你不完整啊,buf和bitMap定义在哪里呢?
#1
这不就是个标准的for循环么? 然后给buf赋值啊
#2

用户登录

没有账号?注册

今日阅读排行

    加载中

一周阅读排行

    加载中