Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #42803
| From | Paul Rubin <no.email@nospam.invalid> |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | Re: How to solve this problem in FORTH? |
| Date | 2015-10-25 15:47 -0700 |
| Organization | A noiseless patient Spider |
| Message-ID | <874mhey38n.fsf@jester.gateway.sonic.net> (permalink) |
| References | <f195a1a1-8609-4319-9df9-d8cbb2a11fdb@googlegroups.com> |
Marek Brunda <marekb@phoenics.org> writes:
> void vadd(int *v1, int *v2, int *v3)
> {
> v3[0] = v1[0] + v2[0];
> v3[1] = v1[1] + v2[1];
> v3[2] = v1[2] + v2[2];
> }
: vv ( i n -- addr ) cells here + @ swap cells + ;
: vx ( i -- ) \ v3[i] = v2[i] + v1[i]
dup dup -1 vv @ >r -2 vv @ r> + swap -3 vv ! ;
: vadd ( v1 v2 v3 -- ) , , , 0 vx 1 vx 2 vx -3 cells allot ;
Back to comp.lang.forth | Previous | Next — Next in thread | Find similar | Unroll thread
Re: How to solve this problem in FORTH? Paul Rubin <no.email@nospam.invalid> - 2015-10-25 15:47 -0700
Re: How to solve this problem in FORTH? Doug Hoffman <glidedog@gmail.com> - 2015-10-27 07:25 -0400
Re: How to solve this problem in FORTH? Doug Hoffman <glidedog@gmail.com> - 2015-10-27 13:04 -0400
Re: How to solve this problem in FORTH? franck.bensusan@gmail.com - 2015-10-27 12:04 -0700
Re: How to solve this problem in FORTH? Doug Hoffman <glidedog@gmail.com> - 2015-10-28 05:42 -0400
csiph-web