fn copy(dst, src) []byte
							parent
							
								
									c7edeb00a8
								
							
						
					
					
						commit
						df06eee5e8
					
				|  | @ -251,3 +251,13 @@ pub fn (b []byte) hex() string { | |||
| 	} | ||||
| 	return string(hex) | ||||
| } | ||||
| 
 | ||||
| // TODO: implement for all types
 | ||||
| pub fn copy(dst, src []byte) int { | ||||
| 	if dst.len > 0 && src.len > 0 { | ||||
| 		min := if dst.len < src.len { dst.len } else { src.len } | ||||
| 		C.memcpy(dst.data, src.left(min).data, dst.element_size*min) | ||||
| 		return min | ||||
| 	} | ||||
| 	return 0 | ||||
| } | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue