Userdata alignment

Squirrel 3.0

Userdata alignment

Both class instances and userdatas can have a buffer associated to them. Squirrel specifies the alignment(in bytes) through the peroprocessor defining 'SQ_ALIGNMENT'. By default SQ_ALIGNMENT is defined as 4 for 32 bits builds and 8 for 64bits builds and builds that use 64bits floats. It is possible to override the value of SQ_ALIGNMENT respecting the following rules. SQ_ALIGNMENT shall be less than or equal to SQ_MALLOC alignments, and it shall be power of 2.

Note

This only applies for userdata allocated by the VM, specified via sq_setclassudsize() or belonging to a userdata object. userpointers specified by the user are not affected by alignemnt rules.