You can not align anything to a specific bit but you can check alignment to bytes so really rather than checking for 32bit alignment you want to be checking for 4 byte alignment (because the ARM has 8 bits per byte).
You will probably need to do something platform specific because you will need to examine the actual value of the pointer which is platform dependent. It would therefore be best to put this in a function that can be changed if the software gets ported to a platform that does not support the method.
You will need to convert the address to an integer type, on an ARM a simple cast will do the trick you probably should cast it to a long. On an ARM int and long are both 32bit IIRC but long is like to be more portable to say a 64bit platform. Once you have the value as an integer it is easy to see if it is 4 byte aligned using the % operator because the value will be exactly divisible by 4 if it is (i.e. % 4 will return 0).
Your function could do 1 of 3 things
- Return a boolean true/false to indictae if the address is 4 byte aligned
- Return the address if it is already 4 byte aligned or the next higher 4 byte aligned address if it is not
- Return the address if it is already 4 byte aligned or the next lower 4 byte aligned address if it is not
Actually 3 is not very useful but 2 can be if you are using an alignment that is not native to the processor. For instance on 1 project we needed memory that was 8 byte aligned on an ARM. By allocting all buffers with an extra 7 bytes you can then shift your working-address in the allocated buffer to an 8 byte aligned address and still have the right amount of data to avoid array boundary problems.
Anyway that is sort of what you do. Like I said very platform specific.