Skip to content

Commit

Permalink
png/core/common (bytevector-copy/part!): New method
Browse files Browse the repository at this point in the history
* modules/png/core/common.scm (bytevector-copy/part!): New method.
  • Loading branch information
artyom-poptsov committed Aug 19, 2023
1 parent 295a08a commit 73f2414
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions modules/png/core/common.scm
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
int16->bytevector
int32->bytevector
bytevector-copy/part
bytevector-copy/part!
bytevector-split
constructor-argument
re-export-modules))
Expand Down Expand Up @@ -71,6 +72,14 @@
(bytevector-copy! bv source-start result 0 len)
result))

(define* (bytevector-copy/part! bv
result
#:key
(source-offset 0)
(source-length (bytevector-length bv))
(target-offset 0))
(bytevector-copy! bv source-offset result target-offset source-length))

(define-method (bytevector-split (bv <bytevector>) (chunk-size <number>))
"Split a bytevector BV into parts of CHUNK-SIZE. Return a list of
bytevectors."
Expand Down

0 comments on commit 73f2414

Please sign in to comment.