Skip to content

Commit c803f61

Browse files
authored
fix and text bitwise ops (#322)
1 parent c93e463 commit c803f61

File tree

2 files changed

+64
-3
lines changed

2 files changed

+64
-3
lines changed

src/ProvidedTypes.fs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14520,7 +14520,7 @@ namespace ProviderImplementation.ProvidedTypes
1452014520
| Int32 | UInt32
1452114521
| Int64 | UInt64
1452214522
| Int16 | UInt16
14523-
| SByte | Byte -> ilg.Emit(I_and)
14523+
| SByte | Byte -> ilg.Emit(I_or)
1452414524
| StaticMethod "op_Or" [|t1; t1|] m ->
1452514525
ilg.Emit(I_call(Normalcall, transMeth m, None))
1452614526
| _ -> failwithf "Operator (|||) not supported for type %s" t1.Name
@@ -14532,7 +14532,7 @@ namespace ProviderImplementation.ProvidedTypes
1453214532
| Int32 | UInt32
1453314533
| Int64 | UInt64
1453414534
| Int16 | UInt16
14535-
| SByte | Byte -> ilg.Emit(I_and)
14535+
| SByte | Byte -> ilg.Emit(I_xor)
1453614536
| StaticMethod "op_Xor" [|t1; t1|] m ->
1453714537
ilg.Emit(I_call(Normalcall, transMeth m, None))
1453814538
| _ -> failwithf "Operator (^^^) not supported for type %s" t1.Name
@@ -14543,7 +14543,7 @@ namespace ProviderImplementation.ProvidedTypes
1454314543
| Int32 | UInt32
1454414544
| Int64 | UInt64
1454514545
| Int16 | UInt16
14546-
| SByte | Byte -> ilg.Emit(I_and)
14546+
| SByte | Byte -> ilg.Emit(I_not)
1454714547
| StaticMethod "op_Not" [|t1; t1|] m ->
1454814548
ilg.Emit(I_call(Normalcall, transMeth m, None))
1454914549
| _ -> failwithf "Operator (~~~) not supported for type %s" t1.Name

tests/GeneratedOpTests.fs

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,4 +1089,65 @@ let ``min execute correctly``() =
10891089
(mn,a)
10901090
)
10911091
]
1092+
1093+
1094+
[<Fact>]
1095+
let ``bitwise and execute correctly``() =
1096+
testProvidedAssembly
1097+
[
1098+
1099+
checkExpr <@ 123441 &&& 4125211 @>
1100+
checkExpr <@ 123441L &&& 4125211L @>
1101+
checkExpr <@ 1234s &&& 4125s @>
1102+
checkExpr <@ 12y &&& 41y @>
1103+
checkExpr <@ 123441u &&& 4125211u @>
1104+
checkExpr <@ 123441UL &&& 4125211UL @>
1105+
checkExpr <@ 1234us &&& 4125us @>
1106+
checkExpr <@ 12uy &&& 41uy @>
1107+
]
1108+
1109+
[<Fact>]
1110+
let ``bitwise or execute correctly``() =
1111+
testProvidedAssembly
1112+
[
1113+
1114+
checkExpr <@ 123441 ||| 4125211 @>
1115+
checkExpr <@ 123441L ||| 4125211L @>
1116+
checkExpr <@ 1234s ||| 4125s @>
1117+
checkExpr <@ 12y ||| 41y @>
1118+
checkExpr <@ 123441u ||| 4125211u @>
1119+
checkExpr <@ 123441UL ||| 4125211UL @>
1120+
checkExpr <@ 1234us ||| 4125us @>
1121+
checkExpr <@ 12uy ||| 41uy @>
1122+
]
1123+
1124+
[<Fact>]
1125+
let ``bitwise xor execute correctly``() =
1126+
testProvidedAssembly
1127+
[
1128+
1129+
checkExpr <@ 123441 ^^^ 4125211 @>
1130+
checkExpr <@ 123441L ^^^ 4125211L @>
1131+
checkExpr <@ 1234s ^^^ 4125s @>
1132+
checkExpr <@ 12y ^^^ 41y @>
1133+
checkExpr <@ 123441u ^^^ 4125211u @>
1134+
checkExpr <@ 123441UL ^^^ 4125211UL @>
1135+
checkExpr <@ 1234us ^^^ 4125us @>
1136+
checkExpr <@ 12uy ^^^ 41uy @>
1137+
]
1138+
1139+
[<Fact>]
1140+
let ``bitwise not execute correctly``() =
1141+
testProvidedAssembly
1142+
[
1143+
1144+
checkExpr <@ ~~~123441 @>
1145+
checkExpr <@ ~~~123441L @>
1146+
checkExpr <@ ~~~1234s @>
1147+
checkExpr <@ ~~~12y @>
1148+
checkExpr <@ ~~~123441u @>
1149+
checkExpr <@ ~~~123441UL @>
1150+
checkExpr <@ ~~~1234us @>
1151+
checkExpr <@ ~~~12uy @>
1152+
]
10921153
#endif

0 commit comments

Comments
 (0)