Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
36f0ee1a
Commit
36f0ee1a
authored
Apr 04, 2014
by
Damien George
Browse files
py: Remove mp_obj_less (use mp_binary_op(MP_BINARY_OP_LESS..) instead).
parent
bd17e1b3
Changes
3
Hide whitespace changes
Inline
Side-by-side
py/builtin.c
View file @
36f0ee1a
...
...
@@ -231,7 +231,7 @@ STATIC mp_obj_t mp_builtin_max(uint n_args, const mp_obj_t *args) {
mp_obj_t
max_obj
=
NULL
;
mp_obj_t
item
;
while
((
item
=
mp_iternext
(
iterable
))
!=
MP_OBJ_NULL
)
{
if
(
max_obj
==
NULL
||
mp_
obj_less
(
max_obj
,
item
))
{
if
(
max_obj
==
NULL
||
mp_
binary_op
(
MP_BINARY_OP_LESS
,
max_obj
,
item
))
{
max_obj
=
item
;
}
}
...
...
@@ -243,7 +243,7 @@ STATIC mp_obj_t mp_builtin_max(uint n_args, const mp_obj_t *args) {
// given many args
mp_obj_t
max_obj
=
args
[
0
];
for
(
int
i
=
1
;
i
<
n_args
;
i
++
)
{
if
(
mp_
obj_less
(
max_obj
,
args
[
i
]))
{
if
(
mp_
binary_op
(
MP_BINARY_OP_LESS
,
max_obj
,
args
[
i
]))
{
max_obj
=
args
[
i
];
}
}
...
...
@@ -260,7 +260,7 @@ STATIC mp_obj_t mp_builtin_min(uint n_args, const mp_obj_t *args) {
mp_obj_t
min_obj
=
NULL
;
mp_obj_t
item
;
while
((
item
=
mp_iternext
(
iterable
))
!=
MP_OBJ_NULL
)
{
if
(
min_obj
==
NULL
||
mp_
obj_less
(
item
,
min_obj
))
{
if
(
min_obj
==
NULL
||
mp_
binary_op
(
MP_BINARY_OP_LESS
,
item
,
min_obj
))
{
min_obj
=
item
;
}
}
...
...
@@ -272,7 +272,7 @@ STATIC mp_obj_t mp_builtin_min(uint n_args, const mp_obj_t *args) {
// given many args
mp_obj_t
min_obj
=
args
[
0
];
for
(
int
i
=
1
;
i
<
n_args
;
i
++
)
{
if
(
mp_
obj_less
(
args
[
i
],
min_obj
))
{
if
(
mp_
binary_op
(
MP_BINARY_OP_LESS
,
args
[
i
],
min_obj
))
{
min_obj
=
args
[
i
];
}
}
...
...
py/obj.c
View file @
36f0ee1a
...
...
@@ -178,17 +178,6 @@ bool mp_obj_equal(mp_obj_t o1, mp_obj_t o2) {
}
}
bool
mp_obj_less
(
mp_obj_t
o1
,
mp_obj_t
o2
)
{
if
(
MP_OBJ_IS_SMALL_INT
(
o1
)
&&
MP_OBJ_IS_SMALL_INT
(
o2
))
{
mp_small_int_t
i1
=
MP_OBJ_SMALL_INT_VALUE
(
o1
);
mp_small_int_t
i2
=
MP_OBJ_SMALL_INT_VALUE
(
o2
);
return
i1
<
i2
;
}
else
{
assert
(
0
);
return
false
;
}
}
machine_int_t
mp_obj_get_int
(
mp_obj_t
arg
)
{
if
(
arg
==
mp_const_false
)
{
return
0
;
...
...
py/obj.h
View file @
36f0ee1a
...
...
@@ -357,7 +357,6 @@ int mp_obj_is_true(mp_obj_t arg);
bool
mp_obj_is_callable
(
mp_obj_t
o_in
);
machine_int_t
mp_obj_hash
(
mp_obj_t
o_in
);
bool
mp_obj_equal
(
mp_obj_t
o1
,
mp_obj_t
o2
);
bool
mp_obj_less
(
mp_obj_t
o1
,
mp_obj_t
o2
);
machine_int_t
mp_obj_get_int
(
mp_obj_t
arg
);
bool
mp_obj_get_int_maybe
(
mp_obj_t
arg
,
machine_int_t
*
value
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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