草庐IT

swift - Swift 中可变位的移位行为

当我试图在我的RGBcolorexperiment上移动位时我注意到我无法移动可变位数。Swift书中只说你“向左/向右移动一个数字”„Thebitwiseleftshiftoperator(>)moveallbitsinanumbertotheleftortherightbyacertainnumberofplaces,accordingtotherulesdefinedbelow.“是否仅能移动预定义的位数?//Worksfine:letshiftMe:UInt32=0xFF0000letshiftedConst=shiftMe>>16//Doesn'twork:letshiftM