[Xorp-cvs] XORP cvs commit: xorp/libxorp

Pavlin Radoslavov pavlin at icir.org
Tue Aug 29 23:37:39 PDT 2006


CVSROOT:	/usr/local/share/doc/apache/cvs
Module name:	xorp
Changes by:	pavlin at xorpc.icir.org	2006-08-30 06:37:39 UTC

XORP CVS repository


Modified files:
	libxorp       utils.hh 

Log message:
	Add a new template class AlignData for aligning buffer data with a
	particular data type.
	
	The technically correct solution is to allocate (using malloc())
	new buffer and copy the original data to it. By definition, the
	malloc()-ed data is aligned, and therefore it can be casted to the
	desired type.
	
	The more efficient solution (but probably technically incorrect),
	is to assume that the first byte of "vector<uint8_t>" buffer is aligned
	similar to malloc()-ed data, and therefore it can be casted to the
	desired type without creating a copy of it.
	
	The desired behavior can be chosen by setting the
	AlignData::_data_is_copied constant to true or false.
	Note that the constant is predefined for all AlignData instances.
	If necessary, the constant can become a variable that can have
	different value for each AlignData instance.

Revision  Changes                                Path
1.18      +48 -1;  commitid: 17f8744f531b47ea6;  xorp/libxorp/utils.hh



More information about the Xorp-cvs mailing list