mirror of
https://gitee.com/apaki/unicstl.git
synced 2025-05-18 03:51:35 +08:00
原版代码测试通过
This commit is contained in:
parent
97ae2a54c4
commit
d2be5d229f
14
src/list.c
14
src/list.c
@ -250,6 +250,13 @@ struct _list* list_slice(struct _list *self, int start, int end, int step)
|
|||||||
}
|
}
|
||||||
start += self->size(self);
|
start += self->size(self);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(start > self->size(self))
|
||||||
|
{
|
||||||
|
start = self->size(self);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(end < 0)
|
if(end < 0)
|
||||||
{
|
{
|
||||||
@ -259,6 +266,13 @@ struct _list* list_slice(struct _list *self, int start, int end, int step)
|
|||||||
}
|
}
|
||||||
end += self->size(self);
|
end += self->size(self);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(end > self->size(self))
|
||||||
|
{
|
||||||
|
end = self->size(self);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// printf("start = %d\n", start);
|
// printf("start = %d\n", start);
|
||||||
// printf("end = %d\n", end);
|
// printf("end = %d\n", end);
|
||||||
|
Loading…
Reference in New Issue
Block a user