@@ -75,6 +75,8 @@ trait GeneralMacros {
7575 val != = symbolOf[OpId .!= ]
7676 val && = symbolOf[OpId .&& ]
7777 val || = symbolOf[OpId .|| ]
78+ val BitwiseAnd = symbolOf[OpId .BitwiseAnd ]
79+ val BitwiseOr = symbolOf[OpId .BitwiseOr ]
7880 val Pow = symbolOf[OpId .Pow ]
7981 val Min = symbolOf[OpId .Min ]
8082 val Max = symbolOf[OpId .Max ]
@@ -1207,6 +1209,16 @@ trait GeneralMacros {
12071209 case _ => unsupported()
12081210 }
12091211 }
1212+ def BitwiseAnd : Calc = (a, b) match {
1213+ case (CalcVal (at : Int , att), CalcVal (bt : Int , btt)) => CalcVal (at & bt, q " $att & $btt" )
1214+ case (CalcVal (at : Long , att), CalcVal (bt : Long , btt)) => CalcVal (at & bt, q " $att & $btt" )
1215+ case _ => unsupported()
1216+ }
1217+ def BitwiseOr : Calc = (a, b) match {
1218+ case (CalcVal (at : Int , att), CalcVal (bt : Int , btt)) => CalcVal (at | bt, q " $att | $btt" )
1219+ case (CalcVal (at : Long , att), CalcVal (bt : Long , btt)) => CalcVal (at | bt, q " $att | $btt" )
1220+ case _ => unsupported()
1221+ }
12101222 def Or : Calc = a match {
12111223 case CalcLit .Boolean (ab) => // `Or` expressions where the LHS is a literal can be inlined
12121224 if (! ab) b match {
@@ -1350,6 +1362,8 @@ trait GeneralMacros {
13501362 case funcTypes.!= => Neq
13511363 case funcTypes.&& => And
13521364 case funcTypes.|| => Or
1365+ case funcTypes.BitwiseAnd => BitwiseAnd
1366+ case funcTypes.BitwiseOr => BitwiseOr
13531367 case funcTypes.Pow => Pow
13541368 case funcTypes.Min => Min
13551369 case funcTypes.Max => Max
0 commit comments