mirror of
				https://github.com/janet-lang/janet
				synced 2025-10-30 23:23:07 +00:00 
			
		
		
		
	Switch to mempcy in some slice functions.
This commit is contained in:
		| @@ -204,12 +204,9 @@ static int cfun_slice(JanetArgs args) { | ||||
|     if (start < 0) start = len + start; | ||||
|     if (end < 0) end = len + end + 1; | ||||
|     if (end >= start) { | ||||
|         int32_t i, j; | ||||
|         ret = janet_array(end - start); | ||||
|         for (j = 0, i = start; i < end; j++, i++) { | ||||
|             ret->data[j] = vals[i]; | ||||
|         } | ||||
|         ret->count = j; | ||||
|         memcpy(ret->data, vals + start, sizeof(Janet) * (end - start)); | ||||
|         ret->count = end - start; | ||||
|     } else { | ||||
|         ret = janet_array(0); | ||||
|     } | ||||
|   | ||||
| @@ -117,11 +117,8 @@ static int cfun_slice(JanetArgs args) { | ||||
|     if (start < 0) start = len + start; | ||||
|     if (end < 0) end = len + end + 1; | ||||
|     if (end >= start) { | ||||
|         int32_t i, j; | ||||
|         ret = janet_tuple_begin(end - start); | ||||
|         for (j = 0, i = start; i < end; j++, i++) { | ||||
|             ret[j] = vals[i]; | ||||
|         } | ||||
|         memcpy(ret, vals + start, sizeof(Janet) * (end - start)); | ||||
|     } else { | ||||
|         ret = janet_tuple_begin(0); | ||||
|     } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Calvin Rose
					Calvin Rose