[ENet-discuss] Using packet-data w/o a memcpy()?

RAULO Emmanuel IT&L@bs emmanuel.raulo at orange-ftgroup.com
Wed May 12 00:27:56 PDT 2010


Hello Mike,

Mike Diehl a écrit :
> switch (event.type) {
> 	case ENET_EVENT_TYPE_RECEIVE:
>
> 		// XXX Are we really going to do a memcpy here?
> 		memcpy(P, event.packet->data, event.packet->dataLength);
> 		break;
> }
>
> How do I convert the 
> EnetPacket* to a void* without simply copying it to a char[]?

Well, event.packet->data *IS* a void*, you don't have to copy it if 
you're that concerned about performance and can just process the data in 
place.
By the way, you will have to call enet_packet_destroy(packet) once 
you're done processing packet data.

Cheers,

--
Emmanuel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: emmanuel_raulo.vcf
Type: text/x-vcard
Size: 363 bytes
Desc: not available
URL: <http://lists.cubik.org/pipermail/enet-discuss/attachments/20100512/681bc69f/attachment.vcf>


More information about the ENet-discuss mailing list