Goose  Diff

Differences From Artifact [4a19dc93e9]:

  • File bs/builtins/operators/logic.cpp — part of check-in [bd7954bf0c] at 2019-08-03 17:16:14 on branch trunk —
    • lexer: handle hex and binary integer literals.
    • builtins: implemented the logic and the compile-time bitwise xor operator.
    (user: achavasse size: 5341)

To Artifact [983f4a5930]:

  • File bs/builtins/operators/logic.cpp — part of check-in [1886f5f367] at 2019-08-03 19:29:43 on branch trunk — Implemented the runtime bitwise xor operator. (user: achavasse size: 5790)

16
17
18
19
20
21
22

23
24
25
26
27


28
29
30
31









32
33
34
35
36
37
38
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50







+





+
+




+
+
+
+
+
+
+
+
+







            {
                return BuildComputedValue( GetValueType< bool >(),
                    Xor( operand, ToValue( true ) ) );
            } )
        );

        CreateLeftAssInfixOp( e, "^"_sid, "operator_xor"_sid, precedence::OrOp,
            // Logical xor
            ForType< bool >( []( auto&& lhs, auto&& rhs ) -> Value
            {
                return BuildComputedValue( GetValueType< bool >(),
                    Xor( lhs, rhs ) );
            } ),

            // ct_int xor
            ForType< APSInt >( []( auto&& lhs, auto&& rhs ) -> Value
            {
                return BuildComputedValue( GetValueType< APSInt >(),
                    Xor( lhs, rhs ) );
            } ),

            // runtime integer xor, defined to work for any two integers of same
            // bit size but ignoring signedness difference.
            ForType< CustomPattern< RTInteger, RTInteger::SizeIntegerPat > >(
            []( auto&& lhs, auto&& rhs ) -> Value
            {
                return BuildComputedValue( lhs.type(),
                    Xor( lhs, rhs ) );
            } )
        );

        CreateLeftAssInfixOp( e, "|"_sid, "operator_or"_sid, precedence::OrOp,
            ForType< bool >( []( auto&& lhs, auto&& rhs ) -> Value
            {
                // Build a CFG that implements the control flow for