|   Registered Member   
 | 
							Using GCC compiler on a Playstaion 3. I am trying to store my Eigen::Matrix4f in a char array to store in a file (and send over network). But this seems to fail... 
 The data I get is 
 Why is it 16 bytes off? I could probably use a for loop to iterate over each float and store it manually, but that just seems so inefficient. Is this because of alignment issues, and if so, how can I solve this in a correct way? Thanks for the help! Edit: Using EIGEN_DONT_ALIGN_STATICALLY solved this problem, but it does seem like a lame way of solving this. Still not a good approach, how could I solve this in a more decent way? | 
|   Moderator   
 | 
							You should really use .data() to get a pointer to the data, then you should also take into account that your char* buffers might not even satisfies the alignment required for float, so your second option is clearly wrong. using memcpy should be safe though: char* out; memcpy(out, mat.data(), sizeof(Matrix4f)); char* in; memcpy(mat.data(), in, sizeof(Matrix4f)); You should also makes sure that on your platform sizeof(Matrix4f)==16*sizeof(float). This should be guaranteed by Eigen but we never tried on the PS3 platform. | 
Registered users: Bing [Bot], claydoh, Google [Bot], rblackwell, Yahoo [Bot]
 
		 
		 
		 
		