diff options
Diffstat (limited to 'core.e')
| -rw-r--r-- | core.e | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/core.e b/core.e index a636c07..62e2301 100644 --- a/core.e +++ b/core.e @@ -757,15 +757,14 @@ here ! ~ Jonesforth also offers C@C! as another name for its CCOPY, but neither ~ "@!" nor "mem@mem!" seems particulaly nice. ~ -~ TODO these parameters feel backwards -~ (destination, source, length --) +~ (source, destination, length --) : memcopy [ here @ ~ We need to save and restore rsi; the other registers we can trample. :rsi :rdx mov-reg64-reg64 :rcx pop-reg64 - :rsi pop-reg64 :rdi pop-reg64 + :rsi pop-reg64 ~ We start from the low end, since that's easier arithmetic. So, we get ~ to leave the DF flag alone. rep-movs8 @@ -777,15 +776,14 @@ here ! ~ careful about which end the transfer starts from. This "move" vs. "copy" ~ distinction mirrors C terminology. ~ -~ TODO these parameters feel backwards -~ (destination, source, length --) +~ (source, destination, length --) : memmove [ here @ ~ We need to save and restore rsi; the other registers we can trample. :rsi :rdx mov-reg64-reg64 :rcx pop-reg64 - :rsi pop-reg64 :rdi pop-reg64 + :rsi pop-reg64 ~ We need to check source < destination to decide which end to start from. :rsi :rax mov-reg64-reg64 @@ -1192,10 +1190,11 @@ here ! : packstring dup stringlen 1 + dup ~ (output point, source, length, length) - 4 roll dup 5 unroll - ~ (destination, source, length, length, output point) + 4 roll dup 4 unroll + + ~ (source, destination, length, length, output point) + 4 unroll - ~ (output point, destination, source, length) + ~ (output point, source, destination, length) memcopy ; ~ (output point, alignment byte count -- output point) |