in reply to Re: Re: How to swap scalar values without copies
in thread How to swap scalar values without copies
To do an immediate swap without copying strings, at XS level, do this -SV xpv +--------+ +-----+ | ANY |--->| PVX |---> char[] | REFCNT | | CUR | | FLAGS | | LEN | +--------+ +-----+
SV xpv +--------+ +-----+ | ANY |-+ ->| PVX |---> char[] | REFCNT | \ / | CUR | | FLAGS | \ / | LEN | +--------+ \/ +-----+ /\ SV / \ xpv +--------+ / \ +-----+ | ANY |-+ ->| PVX |---> char[] | REFCNT | | CUR | | FLAGS | | LEN | +--------+ +-----+
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: How to swap scalar values without copies
by Anonymous Monk on Feb 20, 2004 at 00:43 UTC |