hare

The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit 2ae0ad812024e0bb48139a78ff283951401ebc38
parent a0252a33a8ca8a006b1e09412c8eaaa1bd7005b1
Author: Drew DeVault <sir@cmpwn.com>
Date:   Sun, 31 Jan 2021 15:20:38 -0500

bytes::copy: new function

Diffstat:
Abytes/copy.ha | 8++++++++
1 file changed, 8 insertions(+), 0 deletions(-)

diff --git a/bytes/copy.ha b/bytes/copy.ha @@ -0,0 +1,8 @@ +// Copies bytes from src to dest. dest must have the same length as src. +export fn copy(dest: []u8, src: []u8) void = { + assert(len(dest) == len(src), + "Destination slice must have same length as source slice"); + for (let i = 0z; i < len(dest); i += 1z) { + dest[i] = src[i]; + }; +};