I compared the Kickstart 1.3 BCPL "memcpy" code with that in AROS. As with AROS getvec and clearvec (see bugs 3494128 and 3494752), there's an off-by-one bug with memcpy too; the AROS version copies one fewer longwords than it should.
The proper name for memcpy is copyvec. From the Tripos Kermit source code at http://ftp.nluug.nl/pub/networking/kermit/c/tripos.bcp:
AND copyvec(b1,b2,u) BE
FOR i = 0 TO u DO b2!i := b1!i
So Tripos copyvec copies "length+1" longwords. The Kickstart memcpy/copyvec code also does that. The AROS version only copies "length" longwords.
Some other info about the Kickstart implementation:
- It returns immediately if the length argument in D3.L is negative (so it returns with the source BPTR in D1).
- It happens to return a pointer to the source (D1 on entry shifted left by 2) in D1, but that's probably not required (the function is void).
- It uses a DBF loop, so only the low word of the length argument is used. Again, that's probably not important.
Log in to post a comment.