# Digest #163 2021-09-03

# Contributions

[211] 2021-09-02 10:52:45 AntonErtl wrote:

## referenceImplementation - CMOVE implementation based on MOVE

```
: cmove {: afrom ato u | u1 -- :}
ato afrom - u u< if \ pattern replication case
ato afrom - u over + to u1 begin
afrom afrom 2 pick + 2 pick u1 over - min move
2* dup u u>= until
drop
else \ the usual non-pattern case
ato afrom u move
then ;
```

This is not as simple as copying byte by byte, but significantly more efficient (e.g., factor >10 for 32-bit VFX 4.71 with patterns of length 2) for both cases if MOVE is implemented efficiently.

# Replies

[r721] 2021-09-02 15:39:16 PeterFalth replies:

## referenceImplementation - CMOVE implementation based on MOVE

For the usual non-pattern case should it not be afrom ato u move?

[r722] 2021-09-02 16:47:00 AntonErtl replies:

## referenceImplementation - CMOVE implementation based on MOVE

```
: cmove {: afrom ato u | u1 -- :}
ato afrom - u u< if \ pattern replication case
ato afrom - u over + to u1 begin
afrom afrom 2 pick + 2 pick u1 over - min move
2* dup u u>= until
drop
else \ the usual non-pattern case
afrom ato u move
then ;
```

This is not as simple as copying byte by byte, but significantly more efficient (e.g., factor >10 for 32-bit VFX 4.71 with patterns of length 2) for both cases if MOVE is implemented efficiently.