added a function to convert the buildt in array to a dynamic array
This commit is contained in:
@@ -11,6 +11,14 @@
|
|||||||
|
|
||||||
import mem.sl
|
import mem.sl
|
||||||
|
|
||||||
|
#arr_to_dyn [* | std_arr] -> [* | dyn_arr]
|
||||||
|
word arr_to_dyn
|
||||||
|
dup @ dup dup 3 + alloc dup rot !
|
||||||
|
dup rot 2 * swap 8 + swap ! dup 16 +
|
||||||
|
dup 8 + dup -rot ! 0 swap 3 pick dup @
|
||||||
|
8 * swap 8 + swap memcpy 2drop drop nip
|
||||||
|
end
|
||||||
|
|
||||||
#arr_new [* | cap] -> [* | arr]
|
#arr_new [* | cap] -> [* | arr]
|
||||||
# Create a new array with given initial capacity (minimum 1)
|
# Create a new array with given initial capacity (minimum 1)
|
||||||
word arr_new
|
word arr_new
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ end
|
|||||||
#memdump [*, len | addr] -> [* | addr]
|
#memdump [*, len | addr] -> [* | addr]
|
||||||
word memdump
|
word memdump
|
||||||
for
|
for
|
||||||
dup c@ puti cr 1 +
|
dup @ puti cr 8 +
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user