mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
spec for List.reverse
This commit is contained in:
parent
13d480d5f3
commit
0690633116
4 changed files with 16 additions and 3 deletions
|
@ -141,14 +141,14 @@ const Caller1 = fn (?[*]u8, ?[*]u8, ?[*]u8) callconv(.C) void;
|
|||
const Caller2 = fn (?[*]u8, ?[*]u8, ?[*]u8, ?[*]u8) callconv(.C) void;
|
||||
const Caller3 = fn (?[*]u8, ?[*]u8, ?[*]u8, ?[*]u8, ?[*]u8) callconv(.C) void;
|
||||
|
||||
pub fn listReverse(list: RocList, alignment: u32, element_width: usize) callconv(.C) RocList {
|
||||
pub fn listReverse(list: RocList, alignment: u32, element_width: usize, update_mode: UpdateMode) callconv(.C) RocList {
|
||||
if (list.bytes) |source_ptr| {
|
||||
const size = list.len();
|
||||
|
||||
var i: usize = 0;
|
||||
const end: usize = size - 1;
|
||||
|
||||
if (list.isUnique()) {
|
||||
if (update_mode == .InPlace or list.isUnique()) {
|
||||
|
||||
// Working from the front and back so
|
||||
// we only need to go ~(n / 2) iterations.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue