Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
189c8e1c
Commit
189c8e1c
authored
Jan 13, 2014
by
John R. Lenton
Browse files
Fixed the merge so it worked and compiled and stuff
parent
13e64f06
Changes
1
Hide whitespace changes
Inline
Side-by-side
py/objset.c
View file @
189c8e1c
...
...
@@ -46,23 +46,6 @@ void set_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj
}
static
mp_obj_t
set_binary_op
(
int
op
,
mp_obj_t
lhs_in
,
mp_obj_t
rhs_in
)
{
mp_obj_set_t
*
o
=
lhs_in
;
switch
(
op
)
{
case
RT_COMPARE_OP_IN
:
case
RT_COMPARE_OP_NOT_IN
:
{
mp_obj_t
elem
=
mp_set_lookup
(
&
o
->
set
,
rhs_in
,
false
);
return
((
op
==
RT_COMPARE_OP_IN
)
^
(
elem
==
NULL
))
?
mp_const_true
:
mp_const_false
;
}
default:
// op not supported
return
NULL
;
}
}
static
mp_obj_t
set_make_new
(
mp_obj_t
type_in
,
int
n_args
,
const
mp_obj_t
*
args
)
{
switch
(
n_args
)
{
case
0
:
...
...
@@ -423,6 +406,13 @@ static mp_obj_t set_binary_op(int op, mp_obj_t lhs, mp_obj_t rhs) {
return
set_issuperset
(
lhs
,
rhs
);
case
RT_COMPARE_OP_NOT_EQUAL
:
return
MP_BOOL
(
set_equal
(
lhs
,
rhs
)
==
mp_const_false
);
case
RT_COMPARE_OP_IN
:
case
RT_COMPARE_OP_NOT_IN
:
{
mp_obj_set_t
*
o
=
lhs
;
mp_obj_t
elem
=
mp_set_lookup
(
&
o
->
set
,
rhs
,
MP_MAP_LOOKUP
);
return
MP_BOOL
((
op
==
RT_COMPARE_OP_IN
)
^
(
elem
==
NULL
));
}
default:
// op not supported
return
NULL
;
...
...
@@ -458,7 +448,6 @@ const mp_obj_type_t set_type = {
{
&
mp_const_type
},
"set"
,
.
print
=
set_print
,
.
binary_op
=
set_binary_op
,
.
make_new
=
set_make_new
,
.
binary_op
=
set_binary_op
,
.
getiter
=
set_getiter
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment