473,394 Members | 1,800 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Data Alignement

Hi, I'm new here but I did search this website (and others) for similar threads but found none, so I suppose its safe to post )

Q1. I'm trying to improve my little game engine's speed, so I decided to look into memory alignment. How can I know which part of my program is automatically aligned by the compiler and which part I need to align manually.

Q2. On an MSDN website it read something like "if you are using SSE instructions then you might consider aligning data on 16 byte boundaries" Why is that? Why can't I align it on a lower power of two (lets say on the 4 or 8 byte boundary).

Q3. As I understand the reason for alignment is so that the who instruction fits into one read (I'm using 32 bit XP) of the data bus. So does that as long as no data goes over 4 bytes does not have to be aligned ex:
Expand|Select|Wrap|Line Numbers
  1. __declspec(align(32)) struct sAligned {
  2. char chr; 
  3. short shrt1;   // does not matter if the elements in this struct 
  4. short shrt2;   // are aligned because the whole thing is read in at once anyways? 
  5. }; 
Thanks in advance, you don't have to answer all the questions at once, I would appreciate any help, Thanks, Tim.
Jan 4 '08 #1
0 1013

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: NicK chlam via DotNetMonster.com | last post by:
this is the error i get System.Data.OleDb.OleDbException: Syntax error in INSERT INTO statement. at System.Data.Common.DbDataAdapter.Update(DataRow dataRows, DataTableMapping tableMapping) at...
3
by: bbernieb | last post by:
Hi, All, Is it possible to access a variable inside of a data binding, without the variable being out of scope? (Note: On the DataBinder line, I get an error message that says "Name 'i' is...
5
by: Gene | last post by:
What can I do if I want to get the result using the sql command? for example, the select command is "select Name from Employee where StaffID=10" How to get the "Name"??? dim Name as string and...
5
by: DC Gringo | last post by:
I am having a problem reading a simple update to the database. Basically I'm testing a small change to the pubs database -- changing the price of the Busy Executive's Database Guide from 19.99 to...
2
by: tobiasoed | last post by:
Hello, I want to do something similar to this: #include <stdlib.h> struct coord { double val; double err; };
2
by: Neo | last post by:
I was written this code; in VS2k5 class Program { private: int a;
14
by: Rolf Welskes | last post by:
Hello, I have an ObjectDataSource which has as business-object a simple array of strings. No problem. I have an own (custom) control to which I give the DataSourceId and in the custom-control...
2
by: easter bunny | last post by:
Hi, I try to learn mmx and sse, to begin with i try to understand some examples i found on the net. Basically all __m128 vectors are 16 bit aligned, but one some examples saw them 64 aligned. Is...
10
by: mojmir | last post by:
hello, i've just encountered following piece of code: struct Vector { float x, y, z; inline float & operator (size_t i) {
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.