> > On Wed, 2017-02-15 at 12:07 -0500, Frediano Ziglio wrote: > > > > > > On Thu, Feb 02, 2017 at 04:29:37PM +0000, Frediano Ziglio wrote: > > > > Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx> > > > > --- > > > > server/sound.c | 6 ++---- > > > > 1 file changed, 2 insertions(+), 4 deletions(-) > > > > > > > > diff --git a/server/sound.c b/server/sound.c > > > > index 7c36174..b692646 100644 > > > > --- a/server/sound.c > > > > +++ b/server/sound.c > > > > @@ -384,7 +384,6 @@ static int > > > > snd_playback_send_migrate(PlaybackChannelClient *client) > > > > static int snd_send_volume(SndChannelClient *client, uint32_t > > > > cap, int > > > > msg) > > > > { > > > > SpiceMsgAudioVolume *vol; > > > > - uint8_t c; > > > > RedChannelClient *rcc = RED_CHANNEL_CLIENT(client); > > > > SpiceMarshaller *m = > > > > red_channel_client_get_marshaller(rcc); > > > > SndChannel *channel = > > > > SND_CHANNEL(red_channel_client_get_channel(rcc)); > > > > @@ -398,9 +397,8 @@ static int snd_send_volume(SndChannelClient > > > > *client, > > > > uint32_t cap, int msg) > > > > st->volume_nchannels * sizeof (uint16_t)); > > > > red_channel_client_init_send_data(rcc, msg); > > > > vol->nchannels = st->volume_nchannels; > > > > - for (c = 0; c < st->volume_nchannels; ++c) { > > > > - vol->volume[c] = st->volume[c]; > > > > - } > > > > + SPICE_VERIFY(sizeof(vol->volume[0]) == sizeof(st- > > > > >volume[0])); > > > > + memcpy(vol->volume, st->volume, sizeof(st->volume[0]) * > > > > st->volume_nchannels); > > > > > > I think I prefer the loop version (easier to read). > > > If you really insist on having the memcpy version, > > > Acked-by: Christophe Fergeau <cfergeau@xxxxxxxxxx> > > > > > > > Let's size decide! > > > > Before: > > text data bss dec hex > > filename > > 16588 0 96 16684 412c > > server/.libs/sound.o > > > > After: > > text data bss dec hex > > filename > > 16684 0 96 16780 418c > > server/.libs/sound.o > > > I guess it is due to the SPICE_VERIFY usage > No, SPICE_VERIFY is a compile time check, I verified, it take 0 byte. I think that when gcc when see memcpy it thinks it must do the more fast thing and inline the memcpy to optimize large memory copies. Frediano _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel