Goose  Diff

Differences From Artifact [934bdc05e1]:

  • File bs/builtins/operators/logic.cpp — part of check-in [a67a742689] at 2019-08-07 01:56:03 on branch trunk —
    • Implemented some missing compile time instruction execution for unsigned ints.
    • C++ integer types are now mapped to fixed size integer types, rather than BigInt, now that the former are available at compile time.
    • The binary shift operators for ct_int now take an uint32 as their right hand side operand, rather than a ct_int.
    (user: achavasse size: 9860)

To Artifact [3fcaa0e5dd]:

  • File bs/builtins/operators/logic.cpp — part of check-in [1feb20f522] at 2019-08-13 22:43:49 on branch trunk — Cleanup: got rid of optional< Value > in a lot of places that ought to always return a poison value if an error happens. (user: achavasse size: 9836)

179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
            )
        );

        BuildParseRule( e, "<<"_sid,
            LeftAssInfixOp( "operator_shift_left"_sid, precedence::BitShiftOp,
                // ct_int left shift
                ForTypes< BigInt, uint32_t >(
                []( auto&& lhs, auto&& rhs ) -> optional< Value >
                {
                    return BuildComputedValue( lhs.type(),
                        Shl( lhs, rhs ) );
                } ),

                // runtime integer left shift, defined to work for any two integers of same
                // bit size and signedness.
                ForType< CustomPattern< IntegerType, IntegerType::Pattern > >(
                []( auto&& lhs, auto&& rhs ) -> Value
                {
                    return BuildComputedValue( lhs.type(),
                        Shl( lhs, rhs ) );
                } )
            )
        );

        BuildParseRule( e, ">>"_sid,
            LeftAssInfixOp( "operator_shift_right"_sid, precedence::BitShiftOp,
                // ct_int right shift
                ForTypes< BigInt, uint32_t >(
                []( auto&& lhs, auto&& rhs ) -> optional< Value >
                {
                    return BuildComputedValue( lhs.type(),
                        AShr( lhs, rhs ) );
                } ),

                // runtime signed integer right shift, defined to work for any two integers of same
                // bit size.







|




















|







179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
            )
        );

        BuildParseRule( e, "<<"_sid,
            LeftAssInfixOp( "operator_shift_left"_sid, precedence::BitShiftOp,
                // ct_int left shift
                ForTypes< BigInt, uint32_t >(
                []( auto&& lhs, auto&& rhs ) -> Value
                {
                    return BuildComputedValue( lhs.type(),
                        Shl( lhs, rhs ) );
                } ),

                // runtime integer left shift, defined to work for any two integers of same
                // bit size and signedness.
                ForType< CustomPattern< IntegerType, IntegerType::Pattern > >(
                []( auto&& lhs, auto&& rhs ) -> Value
                {
                    return BuildComputedValue( lhs.type(),
                        Shl( lhs, rhs ) );
                } )
            )
        );

        BuildParseRule( e, ">>"_sid,
            LeftAssInfixOp( "operator_shift_right"_sid, precedence::BitShiftOp,
                // ct_int right shift
                ForTypes< BigInt, uint32_t >(
                []( auto&& lhs, auto&& rhs ) -> Value
                {
                    return BuildComputedValue( lhs.type(),
                        AShr( lhs, rhs ) );
                } ),

                // runtime signed integer right shift, defined to work for any two integers of same
                // bit size.